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 JAVA):

Solution:
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by пользователь on 11.03.2017.
 */
public class TaskVkKv2D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s;
        int n = sc.nextInt();
        s = sc.next();
        byte[] deep = new byte[n];

        int maxSize = 0;
        int b = 0;
        int k = 0;

        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '[') {
                b++;
                deep[i] =(byte) b;
                if (b > maxSize) maxSize = b;
            }
            else {
                if (deep[i - 1] > 0) k++;
                deep[i] = (byte) -b;
                b--;
            }
        }

        //System.out.println(Arrays.toString(deep));
        //System.out.println(k);
        //System.out.println(maxSize);

        for (int i = 0; i < maxSize; i++) {
            for (int j = 0; j < n; j++) {
                if (Math.abs(deep[j]) == i+1) {
                    if (deep[j] > 0) {
                        System.out.print("+-");
                        if (deep[j+1] < 0) System.out.print(" ");
                    }
                    else System.out.print("-+");
                }
                if (Math.abs(deep[j]) > i+1){
                    if (j > 0 && Math.abs(deep[j-1]) == i+1)
                        {}
                    else if (j < n-1 && Math.abs(deep[j + 1]) == i+1) {}
                    else System.out.print(" ");
                    if (deep[j] > 0 && deep[j+1] < 0) System.out.print("   ");
                }
                if (Math.abs(deep[j]) < i+1) {
                    System.out.print("|");
                    if (deep[j] > 0 && deep[j+1] < 0) System.out.print("   ");
                }
            }
            System.out.println();
        }
        for (int j = 0; j < n; j++) {
            System.out.print("|");
            if (deep[j] > 0 && deep[j+1] < 0) System.out.print("   ");
        }
        System.out.println();
        int buf;
        for (int i = 0; i < maxSize; i++) {
            buf = maxSize - i;
            for (int j = 0; j < n; j++) {
                if (Math.abs(deep[j]) == buf) {
                    if (deep[j] > 0) {
                        System.out.print("+-");
                        if (deep[j+1] < 0) System.out.print(" ");
                    }
                    else System.out.print("-+");
                }
                if (Math.abs(deep[j]) > buf){
                    if (j > 0 && Math.abs(deep[j-1]) == buf)
                    {}
                    else if (j < n-1 && Math.abs(deep[j + 1]) == buf) {}
                    else System.out.print(" ");
                    if (deep[j] > 0 && deep[j+1] < 0) System.out.print("   ");
                }
                if (Math.abs(deep[j]) < buf) {
                    System.out.print("|");
                    if (deep[j] > 0 && deep[j+1] < 0) System.out.print("   ");
                }
            }
            System.out.println();
        }


    }
}