CRTALO | 프로그래밍의 벗 PivotOJ
PivotOJ

CRTALO

시간 제한: 2000ms메모리 제한: 128MB출처: CHC 2007 Regional Competition - JuniorsBOJ 1730

문제

Slavko's newest invention is a drawing machine. The machine has a pencil and can be programmed to draw various shapes. This particular one draws shapes on a piece of paper divided into N×N squares. 

In the beginning, the paper is empty. The starting position of the pencil is in the upper-left corner.

Slavko uses a microprocessor (which he found at Mirko’s village hall, next to the bag of sodium and an empty bucket) to send movement orders to the machine. The orders state in which direction the machine moves its pencil (up, down, left, right). As the pencil moves, it leaves a trail on the paper.

If a command would have the pencil go out of the paper boundaries, that order is ignored, and the pencil stays where it was.

Given a sequence of commands, output what the paper looks like after the machine has completed those commands. 

We say that the pencil went through a square horizontally if it entered or exited the square while performing the left or right command. Similarly, we define that the pencil went through the square vertically if it entered or exited the square while performing either the up or down command. 

Format the output as follows: 

  • The squares that the pencil never entered are displayed as dots ('.'); 
  • The squares that the pencil only went through horizontally are displayed as minus signs ('-'); 
  • The squares that the pencil only went through vertically are displayed as vertical lines ('|'); 
  • The squares that the pencil went through both horizontally and vertically are displayed as plus signs ('+'). 

입력

The first line of input consists of one integer, N. (2 ≤ N ≤ 10), the paper size. 

The second line contains a string of up to 250 characters. That string represents the orders that Slavko issued to the machine. The orders are: up ('U'), down ('D'), left ('L') and right ('R'). 

출력

Output the appearance of the paper as described in the task. 

The output should consist of exactly N lines, and each line of N characters. The only characters allowed in the output are dots (ASCII value 46), minus signs (45), vertical lines (124) and plus signs (43). 

예제

예제 1

입력
5
DRDRRUU
출력
|..|.
++.|.
.+-+.
.....
.....

예제 2

입력
4
RRRDDDDULL
출력
---+
...|
.--+
...|

예제 3

입력
5
RRDDLLUURRDDLLUUR
출력
+-+..
|.|..
+-+..
.....
.....
코드를 제출하려면 로그인하세요.