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

Examples

Input

8
[[][]][]


Output

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


Input

6
[[[]]]


Output

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


Input

6
[[][]]


Output

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


Input

2
[]


Output

+- -+
|   |
+- -+


Input

4
[][]


Output

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

Solution (in PYTHON3):

Solution:
""" Created by Henrikh Kantuni and Shahen Kosyan on 3/12/17 """

from itertools import groupby

if __name__ == "__main__":
    n = int(input())
    seq = list(input())

    answer = []
    stack = []
    depth = -1
    for i in range(len(seq)):
        if seq[i] == '[':
            stack.append('[')
            depth += 2
            answer.append(depth)
        else:
            stack.pop()
            answer.append(depth)
            depth -= 2

            if len(stack) == 0:
                answer.append('*')

    answer = [list(group) for k, group in groupby(answer, lambda x: x != "*") if k]

    max_depth = 0
    for i in range(len(answer)):
        if max_depth < max(answer[i]):
            max_depth = max(answer[i])

    for i in range(len(answer)):
        answer[i] = [(max_depth + 1 - a) for a in answer[i]]

    # flatten
    answer = [s for sub in answer for s in sub]

    # print(answer)
    # print()

    out = ""
    stack = []
    for i in range(len(answer)):
        line = ""

        if seq[i] == "[" and len(stack) == 0:
            line += " " * ((max_depth - answer[i]) // 2)
            line += "+"
            line += "|" * answer[i]
            line += "+"
            line += " " * ((max_depth - answer[i]) // 2)

            if seq[i + 1] == "]":
                line += " " * ((max_depth - answer[i]) // 2)
                line += "-"
                line += " " * answer[i]
                line += "-"
                line += " " * ((max_depth - answer[i]) // 2)

            stack.append(answer[i])
        elif seq[i] == "[" and len(stack) > 0:
            if seq[i - 1] == "[":
                line += " " * ((max_depth - answer[i] - 2) // 2)
                line += "-"
            else:
                line += " " * ((max_depth - answer[i]) // 2)

            line += "+"
            line += "|" * answer[i]
            line += "+"

            if seq[i - 1] == "[":
                line += "-"
                line += " " * ((max_depth - answer[i] - 2) // 2)
            else:
                line += " " * ((max_depth - answer[i]) // 2)

            if seq[i + 1] == "]":
                line += " " * ((max_depth - answer[i]) // 2)
                line += "-"
                line += " " * answer[i]
                line += "-"
                line += " " * ((max_depth - answer[i]) // 2)

            stack.append(answer[i])
        elif seq[i] == "]":
            if seq[i - 1] == "[":
                line += " " * ((max_depth - answer[i]) // 2)
                line += "-"
                line += " " * answer[i]
                line += "-"
                line += " " * ((max_depth - answer[i]) // 2)

            if i < len(answer) - 1 and seq[i + 1] == "]":
                line += " " * ((max_depth - answer[i] - 2) // 2)
                line += "-"
                line += "+"
                line += "|" * answer[i]
                line += "+"
                line += "-"
                line += " " * ((max_depth - answer[i] - 2) // 2)
            else:
                line += " " * ((max_depth - answer[i]) // 2)
                line += "+"
                line += "|" * answer[i]
                line += "+"
                line += " " * ((max_depth - answer[i]) // 2)

            stack.pop()

        out += line

    # divide into chunks of size = max_depth + 2
    out = [out[i:i + max_depth + 2] for i in range(0, len(out), max_depth + 2)]

    # for i in range(len(out)):
    #     print(out[i])
    # print()

    # add a new line between - - and - -
    i = 0
    while i < len(out):
        if out[i].replace(" ", "") == "--" and out[i + 1].replace(" ", "") == "--":
            out.insert(i + 1, " " * len(out[i]))
        i += 1

    vertical = [list(r) for r in out]

    # horizontal
    final = ""
    for i in range(len(vertical[0])):
        for j in range(len(vertical)):
            final += vertical[j][i]
        final += "\n"

    # remove the trailing space
    final = final[:-1]

    print(final)