P29393 [洛谷] [COCI2008-2009#4] ROT
普及-
题目描述

Problem Description

Given a table of characters of size $r \times c$, you need to output the state of this table after rotating it clockwise by $k$ degrees.

It is guaranteed that $k$ is a multiple of 45.

Input Format

The first line of input contains two integers $r$ and $c$, representing the number of rows and columns of the table, respectively.

The next $r$ lines, each containing $c$ characters, represent the initial arrangement of the character table.

The following line contains an integer $k$, representing the angle of rotation in a clockwise direction.

Output Format

Output the final state of the table after rotation.

Sample Input and Output

Sample Input #1

3 5
damir
marko
darko
45

Sample Output #1

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

Sample Input #2

3 5
damir
marko
darko
90

Sample Output #2

dmd
aaa
rrm
kki
oor

Sample Input #3

5 5
abcde
bcdef
cdefg
defgh
efghi
315

Sample Output #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 

Notes

Data Size and Constraints

For $100\%$ of the data, $1 \le r, c \le 10$.

Notes

This problem is translated from COCI2008-2009 CONTEST #4 T3 ROT.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 5 damir marko darko 45
样例输出
d m a d a m a r i r k r k o o