#P6450. [COCI 2008/2009 #4] ROT

[COCI 2008/2009 #4] ROT

Description

Given a character table of size r×cr \times c, output the state of this table after rotating it clockwise by kk degrees.

It is guaranteed that kk is a multiple of 4545.

Input Format

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

The next rr lines each contain cc characters, representing the initial arrangement of the character table.

The next line contains an integer kk, representing the clockwise rotation angle.

Output Format

Output the final state of the table after rotation.

3 5
damir
marko
darko
45
  d
 m a
d a m
 a r i
  r k r
   k o
    o
3 5
damir
marko
darko
90
dmd
aaa
rrm
kki
oor
5 5
abcde
bcdef
cdefg
defgh
efghi
315
    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 

Hint

Constraints

For 100%100\% of the testdata, 1r,c101 \le r, c \le 10.

Notes

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

Translated by ChatGPT 5