Damir likes to rotate. Right now he is rotating tables of letters. He wrote an
It turns out this task is a bit too hard for Damir, so help him out.
Input Specification
The first line contains two integers
Each of the next
Output Specification
Output Damir's table rotated
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
Comments