/
Time Limit: 2 sec / Memory Limit: 1024 MiB
問題文
縦 N マス、横 N マスのグリッドがあります。
グリッドの各マスには文字 v が様々な向きで 1 個ずつ書きこまれています。上から i 行目、左から j 列目のマスに書きこまれている文字の向きは c_{i, j} で表されて、
- c_{i,j} =
vの時は通常のvが、 - c_{i,j} =
^の時は 180 度回転したvが、 - c_{i,j} =
<の時は時計回りに 90 度回転したvが、 - c_{i,j} =
>の時は反時計回りに 90 度回転したvがマスに書きこまれています。
今、グリッド全体を時計回りに 90 度回転させました。
回転させた後のグリッドの各マスに書きこまれている文字の向きを出力してください。
制約
- 1 \leq N \leq 100
- c_{i, j} は
v,^,<,>のいずれか
入力
入力は以下の形式で標準入力から与えられる。
N
c_{1,1}c_{1,2}\dots c_{1,N}
c_{2,1}c_{2,2}\dots c_{2,N}
\vdots
c_{N,1}c_{N,2}\dots c_{N,N}
出力
回転させた後のグリッドの各マスに書きこまれている文字の向きを以下の形式で出力せよ。
a_{1,1}a_{1,2}\dots a_{1,N}
a_{2,1}a_{2,2}\dots a_{2,N}
\vdots
a_{N,1}a_{N,2}\dots a_{N,N}
ここで a_{i, j} は上から i 行目、左から j 列目のマスに書きこまれている文字の向きを表して、
- a_{i,j} =
vの時は通常のvを、 - a_{i,j} =
^の時は 180 度回転したvを、 - a_{i,j} =
<の時は時計回りに 90 度回転したvを、 - a_{i,j} =
>の時は反時計回りに 90 度回転したvを意味する。
入力例 1
1 v
出力例 1
<
v を時計回りに 90 度回転させると < になります。
入力例 2
3 >>^ ><> v<^
出力例 2
<vv ^^v >v>
入力例 3
5 ^^>vv v>^^v <vv<v >^><> >>^v>
出力例 3
vv^<> v><v> >v<>v <^^>< vv<<<
Problem Statement
There is a grid with N horizontal rows and N vertical columns.
Each cell in the grid has the character v written in various orientations. The orientation of v written on the cell in the i-th row from the top and j-th column from the left is described by c_{i, j}:
- if c_{i,j} =
v, an ordinaryvis written; - if c_{i,j} =
^, an upside-downvis written; - if c_{i,j} =
<, avrotated 90 degrees clockwise is written; - if c_{i,j} =
>, avrotated 90 degrees counterclockwise is written.
Now you will rotate the grid 90 degrees clockwise.
Print the orientations of the characters in the resulting grid.
Constraints
- 1 \leq N \leq 100
- c_{i, j} is one of
v,^,<, or>.
Input
The input is given from Standard Input in the following format:
N
c_{1,1}c_{1,2}\dots c_{1,N}
c_{2,1}c_{2,2}\dots c_{2,N}
\vdots
c_{N,1}c_{N,2}\dots c_{N,N}
Output
Print the orientations of the characters in the resulting grid in the following format:
a_{1,1}a_{1,2}\dots a_{1,N}
a_{2,1}a_{2,2}\dots a_{2,N}
\vdots
a_{N,1}a_{N,2}\dots a_{N,N}
Here, a_{i, j} denotes the orientation of v written on the cell in the i-th row from the top and j-th column from the left:
- a_{i,j} =
vmeans an ordinaryvis written; - a_{i,j} =
^means an upside-downvis written; - a_{i,j} =
<means avrotated 90 degrees clockwise is written; - a_{i,j} =
>means avrotated 90 degrees counterclockwise is written.
Sample Input 1
1 v
Sample Output 1
<
Rotating v 90 degrees clockwise makes it <.
Sample Input 2
3 >>^ ><> v<^
Sample Output 2
<vv ^^v >v>
Sample Input 3
5 ^^>vv v>^^v <vv<v >^><> >>^v>
Sample Output 3
vv^<> v><v> >v<>v <^^>< vv<<<