Everyone knows that laughter comes in three types of pitches: up, down, and right. Kiara is especially interested in the laughing patterns of her friend, and wishes to graph it out to see what interesting shapes come out.
Kiara wants you to generate the graph of a laugh that is pitches long. Each pitch will be given to you either as the character ^
(for up), v
(for down), or >
(for right).
To generate the graph, imagine that you are working on a 2D grid of characters with infinite rows and columns. In the beginning, all characters in the grid are set to .
, and your cursor is positioned in the first column. For every pitch given to you, perform the respective action:
^
pitch: replace the current character with/
, and move the cursor one character to the right and one character up.v
pitch: move the cursor one character down, replace the current character with\
, and move the cursor one character to the right.>
pitch: replace the current character with_
, and move the cursor one character to the right.
Although our hypothetical grid has infinite rows, for ease of comprehension, you should output only the rows which contain a character that is not .
(i.e. print out all rows that contain one of /
, \
, or _
).
Constraints
Input Specification
The first line will contain a single integer .
The second line will contain a string of characters, each of which will be one of ^
, v
, or >
.
Output Specification
Output the laugh graph, using the procedure described.
Sample Input 1
6
vv>^^^
Sample Output 1
...../
\.../.
.\_/..
Sample Input 2
5
vvvvv
Sample Output 2
\....
.\...
..\..
...\.
....\
Explanation of Sample Output 2
Note that only rows containing non-.
characters should be included.
Comments
How do you get the starting row?
why is there an error when I try to set a string to "\"?
https://stackoverflow.com/questions/12103445/using-in-a-string-as-literal-instead-of-an-escape
For folks looking for reasons to do contests outside of DMOJ - this problem appeared on the most recent COCI contest.
This guy came in, did hello world, and just left. Sigmillionaire grindset....
If anyone is getting stuck on this question, try inputting: