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.io.*;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class ProblemD {

    public static void main(String[] args) throws Exception {
        Locale.setDefault(Locale.UK);
        new ProblemD();
    }

    private BufferedReader in = null;
    private PrintWriter out = null;
    private StringTokenizer tok = new StringTokenizer("");
    private String fileName = "#Console";

    public ProblemD() throws Exception {
        init();
        solve();
        in.close();
        out.close();
    }

    private void solve() throws Exception {
        int n = nextInt();
        char[] a = in.readLine().toCharArray();
        int[] h = new int[n];
        int maxH = 0;
        for (int i = 0, curH = 0; i < n; i++) {
            if (a[i] == '[') {
                h[i] = ++curH;
                if (maxH < curH) {
                    maxH++;
                }
            } else {
                h[i] = curH--;
            }
        }


        char[][] ans = new char[100 + 4 * n][100 + 4 * n];
        for (int i = 0; i < ans.length; i++) {
            Arrays.fill(ans[i], ' ');
        }
        int col = 0;
        for (int i = 0; i < n; i++) {
            int st = h[i];
            int fn = 2 * maxH - h[i] + 2;
            ans[col][st] = '+';
            ans[col][fn] = '+';
            if (a[i] == '[') {
                ans[col + 1][st] = '-';
                ans[col + 1][fn] = '-';
            } else {
                ans[col - 1][st] = '-';
                ans[col - 1][fn] = '-';
            }
            for (int j = st + 1; j < fn; j++) {
                ans[col][j] = '|';
            }
            if (a[i] == '[' && a[i + 1] == ']') {
                col += 4;
            } else {
                col += 1;
            }
        }

        for (int i = 1; i < 2 * maxH + 2; i++) {
            for (int j = 0; j < col; j++) {
                out.print(ans[j][i]);
            }
//            if (i != 2 * maxH + 1)
            out.println();
        }
    }


    private void init() throws FileNotFoundException {
        if (fileName.equals("#Console")) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else if (fileName.equals("#IOtxt")) {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } else {
            in = new BufferedReader(new FileReader(fileName + ".in"));
            out = new PrintWriter(fileName + ".out");
        }
    }


    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }


    private String nextToken() throws IOException {
        while (!tok.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null) {
                return null;
            }
            tok = new StringTokenizer(s);
        }
        return tok.nextToken();
    }

}