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 test_4 {


    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        byte x = input.nextByte();
        input.nextLine();
        String c = input.nextLine();
        c = c.trim();
        int level = 1;
        int length = c.length();
        String[] levels = new String[length+x*3];
        int ind_open_skobka = 0;
        int max_skobka = 0;
        int temp_ind_open_skobka = -1;
        int ind_close_skobka = c.indexOf(new String("]"),0);
        int prob = 0;
        for (int i = 0; ;i++ ) {

            temp_ind_open_skobka = c.indexOf(new String("["),temp_ind_open_skobka+1);
            if (temp_ind_open_skobka>ind_close_skobka||temp_ind_open_skobka==-1)
            {
                if (max_skobka<level)
                    max_skobka = level-1;
                prob++;
                for (int j = 0; j<3 ; j++) {
                    levels[i] = "p";
                    i++;
                }
                if (temp_ind_open_skobka==-1) {
                    for (int j = ind_open_skobka;; )
                    {
                        level--;
                        ind_close_skobka = c.indexOf(new String("]"),j);
                        if (ind_close_skobka<= 0)
                            break;
                        levels[i] =  Integer.toString(-level);
                        j = ind_close_skobka+1;
                        i++;
                    }
                    break;
                }
                for (int j = ind_open_skobka; j < temp_ind_open_skobka; )
                {
                    ind_close_skobka = c.indexOf(new String("]"),j);
                    level--;
                    levels[i] =  Integer.toString(-level);
                    i++;
                    j = ind_close_skobka+1;
                }
                ind_close_skobka = c.indexOf(new String("]"),temp_ind_open_skobka);

            }
            ind_open_skobka = temp_ind_open_skobka;
            levels[i] =  Integer.toString(level);
            level++;
        }

        int height = (max_skobka-1)*2+1+2;
        char[][] result  = new char[height][length+3*prob];
        for (int i = 0; i < length+3*prob; i++) {
            if (levels[i] !="p")
            {
                result[(height) / 2][i] = '|';
                int j;
                for (j = 0; j < max_skobka  - Math.abs(Integer.parseInt(levels[i])); j++){
                    result[(height) / 2 - j - 1][i] = '|';
                }
                result[(height) / 2 - j -1][i] = '+';
                if (Integer.parseInt(levels[i])<0)  result[(height) / 2 - j -1][i-1] = '-';
                else result[(height) / 2 - j -1][i+1] = '-';
                for (j = (height) / 2 - j - 2; j >= 0; j--)
                    if (result[j][i] != '-') result[j][i] = ' ';

                for (j = 0; j < max_skobka  - Math.abs(Integer.valueOf(levels[i])); j++)
                    result[(height) / 2  + j + 1 ][i] = '|';
                result[(height) / 2  + j + 1][i] = '+';
                if (Integer.parseInt(levels[i])<0)   result[(height) / 2  + j + 1][i-1] = '-';
                else  result[(height) / 2  + j + 1][i+1] = '-';
                for (j = (height) / 2 + j + 2; j < height; j++)
                    if (result[j][i] != '-') result[j][i] = ' ';
            } else for (int j = 0; j < height; j++)
                if (result[j][i] != '-') result[j][i]=' ';
        }
        for (int i = 0; i < height; i++) {
            for (int j = 0; j < length+3*prob; j++)
                System.out.print(result[i][j]);
            System.out.println();
        }
    }
}