VK Cup 2017 - Qualification 2
D
Draw Brackets!
Codeforces
1400
原题
← C→
翻译中…

A sequence of square brackets is regular if by inserting symbols "+" and "1" into it, you can get a regular mathematical expression from it. For example, sequences "[[]][]", "[]" and "[[][[]]]" — are regular, at the same time "][", "[[]" and "[[]]][" — are irregular.

翻译中…

Draw the given sequence using a minimalistic pseudographics in the strip of the lowest possible height — use symbols '+', '-' and '|'. For example, the sequence "[[][]][]" should be represented as:

翻译中…

+-        -++- -+
|+- -++- -+||   |
||   ||   |||   |
|+- -++- -+||   |
+-        -++- -+

翻译中…

Each bracket should be represented with the hepl of one or more symbols '|' (the vertical part) and symbols '+' and '-' as on the example which is given above.

翻译中…

Brackets should be drawn without spaces one by one, only dividing pairs of consecutive pairwise brackets with a single-space bar (so that the two brackets do not visually merge into one symbol). The image should have the minimum possible height.

翻译中…

The enclosed bracket is always smaller than the surrounding bracket, but each bracket separately strives to maximize the height of the image. So the pair of final brackets in the example above occupies the entire height of the image.

翻译中…

Study carefully the examples below, they adequately explain the condition of the problem. Pay attention that in this problem the answer (the image) is unique.

翻译中…

Input

翻译中…

The first line contains an even integer $*n*$ ($2 ≤ *n* ≤ 100$) — the length of the sequence of brackets.

翻译中…

The second line contains the sequence of brackets — these are $*n*$ symbols "[" and "]". It is guaranteed that the given sequence of brackets is regular.

翻译中…

Output

翻译中…

Print the drawn bracket sequence in the format which is given in the condition. Don't print extra (unnecessary) spaces.

翻译中…

样例

Input #1
8
[[][]][]
Output #1
+-        -++- -+
|+- -++- -+||   |
||   ||   |||   |
|+- -++- -+||   |
+-        -++- -+
InputCopy OutputCopy
Input #2
6
[[[]]]
Output #2
+-     -+
|+-   -+|
||+- -+||
|||   |||
||+- -+||
|+-   -+|
+-     -+
InputCopy OutputCopy
Input #3
6
[[][]]
Output #3
+-        -+
|+- -++- -+|
||   ||   ||
|+- -++- -+|
+-        -+
InputCopy OutputCopy
Input #4
2
[]
Output #4
+- -+
|   |
+- -+
InputCopy OutputCopy
Input #5
4
[][]
Output #5
+- -++- -+
|   ||   |
+- -++- -+
InputCopy OutputCopy
题目信息
题号
770D
时间限制
1 s
内存限制
256 MB
标签
*special
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。