프로그램 명: coci_rot
제한시간: 1 초

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.

입력

출력

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.

입출력 예

input 

3 5 
damir 
marko 
darko 
45 

output 

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

input 

3 5 
damir 
marko 
darko 
90 

output 

dmd 
aaa 
rrm 
kki 
oor 

input 

5 5 
abcde 
bcdef 
cdefg 
defgh 
efghi 
315 

output 

    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
출처: coci 2008/2009 contest4 3/6

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]