What Does Milk Say When It Falls Over?
InterviewTime limit1sMemory limit1024 MB
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!

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.
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.