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.*;
public class B {
    static Scanner in=new Scanner(System.in);
    static void test_case(){
        int n=in.nextInt();
        char[] s=in.next().toCharArray();
        int[] a=new int[n];
        int c=0,m=0,cnt=0;
        for(int i=0;i<n;i++){
            boolean y=true;
            if(s[i]=='['){
                c++;
            }else{
                c--;
                y=false;
            }
            if(s[i]=='['&&s[i+1]==']'){
                cnt++;
            }
            a[i]=c+(!y ?1:0);
            m=Math.max(m,a[i]);
        }
        int w=n+cnt*3,h=2*m+1;
        char[][] r=new char[h][w+1];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                r[i][j]=' ';
            }
        }
        int cur=0;
        for(int i=0;i<n;i++){
            int he=2*(m-a[i]+1)-1;
            int hy=h/2+1,wy=he/2+1;
            if(s[i]=='['){
                r[hy+wy-1][cur]=r[hy-wy-1][cur]='+';
                for(int j=hy-wy;j<=hy+wy-1-1;j++){
                    r[j][cur]='|';
                }
                cur++;
                r[hy+wy-1][cur]=r[hy-wy-1][cur]='-';
//                cur++;
            }else{
                r[hy+wy-1][cur]=r[hy-wy-1][cur]='-';
                cur++;
                r[hy+wy-1][cur]=r[hy-wy-1][cur]='+';
                for(int j=hy-wy;j<=hy+wy-1-1;j++){
                    r[j][cur]='|';
                }
                if(i+1<n&&s[i+1]=='['){
                    cur++;
                }
            }
            if(s[i]=='['&&s[i+1]==']'){
                cur+=2;
            }
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                print(r[i][j]);
            }
            println();
        }
    }
    public static void main(String[] args) {
        int n=1,case_=1;
//        n=in.nextInt();
        while (case_<=n){
//            println("Case #"+case_+": ");
            test_case();
            case_++;
        }
    }
    static void print(Object o) { System.out.print(o); }
    static void println(Object o) { print(o);println(); }
    static void println(){print('\n');}
   
}