Under construction

Still being built. Things may change

What Does Milk Say When It Falls Over?

Interview

Time limit1sMemory limit1024 MB

Summary
Given a grid of ASCII art characters, rotate it 90 degrees to the left, mapping each character to its rotated counterpart.
Level

Easy3 of 10

Topics
Implementation, Matrix, Brute force, Simulation
Solved
No attempts yet

Problem

Seongwon has an excellent sense of humor and prepares a funny joke every day. Today's joke is this.

What does milk say when it falls over? The answer is "ouch"! Ha ha!

When his friends reacted with indifference, Seongwon added an explanation.

If you tip a box with "MILK" written vertically over to the left, it becomes "OUCH", right? The funny part is that it looks like the milk fell over and got hurt!

milk

His friends still did not laugh, so Seongwon decided they lacked spatial perception and could not picture the box tipping over. He resolved to write a program that tips the box over and show his friends the result.

Seongwon wants the program to work well even when the box has a picture other than "MILK" on it. He draws a picture by dividing a face of the box into a grid and putting one of the characters below into each cell.

CharacterNameASCIIAfter rotating
.period46.
Ouppercase O79O
-hyphen45|
|vertical bar124-
/slash47\
\backslash92/
^caret94<
<less-than sign60v
vlowercase V118>
>greater-than sign62^

Seongwon has no time to write the program because he is thinking up tomorrow's joke. Write the program for him.

Input

The first line gives two integers N and M, the height and width of the picture (1 ≤ N, M ≤ 100).

The next N lines each give a string of M characters representing one row of the picture. The string contains no spaces, and is guaranteed to consist only of the characters given in the table above.

Output

Over M lines, print the result of tipping the input picture over to the left.

Examples2

  1. Example 1

    Input
    14 7
    .......
    ...O...
    .......
    .-----.
    ...|...
    ...|...
    .......
    .......
    ...O...
    .......
    .-----.
    ..|.|..
    ..|.|..
    .......
    
    Expected output
    ..............
    ...|......|...
    ...|......|--.
    .O.|--..O.|...
    ...|......|--.
    ...|......|...
    ..............
    
  2. Example 2

    Input
    7 6
    ..^...
    /---\.
    <...|\
    <.O.|>
    <...|/
    \---/.
    ..v...
    
    Expected output
    ../^\..
    ./---\.
    .|...|.
    <|.O.|>
    .|...|.
    .\vvv/.