#929
Silver II
ROT
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Damir likes to rotate. Right now he is rotating tables of letters. He wrote an R×C table onto a piece of paper. He has also chosen an angle K, a multiple of 45, and wants to rotate his table that many degrees clockwise. It turns out this task is a bit too hard for Damir, so help him out.

입력

The first line contains two integers R and C separated by a space (1 ≤ R ≤ 10, 1 ≤ C ≤ 10) the number of rows and columns in Damir's table. Each of the next R lines contains one row of Damir's table, a string of C lowercase letters. The last line contains an integer K, a multiple of 45 between 0 and 360 (inclusive).

출력

Output Damir's table rotated K degrees clockwise, like shown in the examples. The output should contain the smallest number of rows necessary. Some rows may have leading spaces, but no rows may have trailing spaces.

예제 입력 1

3 5
damir
marko
darko
45

예제 출력 1

  d
 m a
d a m
 a r i
  r k r
   k o
    o

예제 입력 2

3 5
damir
marko
darko
90

예제 출력 2

dmd
aaa
rrm
kki
oor

예제 입력 3

5 5
abcde
bcdef
cdefg
defgh
efghi
315

예제 출력 3

    e
   d f
  c e g
 b d f h
a c e g i
 b d f h
  c e g
   d f
    e
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Silver II1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.