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.*;

/**
 * Created by amir.
 */

public class A {

    private void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        String s = in.next();
        int[] sym = new int[n];
        int[] depth = new int[n];
        Stack<Integer> st = new Stack<>();
        int maxDepth = 0;
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == '[') {
                depth[i] = st.size();
                st.push(i);
            } else {
                int x = st.pop();
                sym[x] = i;
                sym[i] = x;
                depth[i] = depth[x];
            }
            maxDepth = Math.max(maxDepth, st.size());
        }
        /*
        System.out.println("sym");
        for (int i = 0; i < n; i++) {
            System.out.print(sym[i] + " ");
        }
        System.out.println();
        System.out.println("depth");
        for (int i = 0; i < n; i++) {
            System.out.print(depth[i] + " ");
        }
        System.out.println();
        System.out.println("numINs");
        for (int i = 0; i < n; i++) {
            System.out.print(numOfInside[i] + " ");
        }
        System.out.println();
        */
        int ansSizeX = n * 3;
        int ansSizeY = n + 1;
        char[][] ans = new char[ansSizeX][ansSizeY];
        for (int i = 0; i < ansSizeX; i++) {
            Arrays.fill(ans[i], ' ');
        }
        int curPosX = 0;
        for (int i = 0; i < n; i++) {
            int curPosY = depth[i];
            if (i != 0 && s.charAt(i - 1) == '[' && s.charAt(i) == ']')
                curPosX += 3;
            if (s.charAt(i) == '[') {
                ans[curPosX][curPosY] = ans[curPosX][curPosY + 2 * (maxDepth - depth[i])] = '+';
                ans[curPosX + 1][curPosY] = ans[curPosX + 1][curPosY + 2 * (maxDepth - depth[i])] = '-';
            } else {
                ans[curPosX][curPosY] = ans[curPosX][curPosY + 2 * (maxDepth - depth[i])] = '+';
                ans[curPosX - 1][curPosY] = ans[curPosX - 1][curPosY + 2 * (maxDepth - depth[i])] = '-';
            }
            for (int j = curPosY + 1; j < curPosY + 2 * (maxDepth - depth[i]); j++) {
                ans[curPosX][j] = '|';
            }
            curPosX++;
        }
        for (int i = 0; i < ansSizeY; i++) {
            StringBuilder sb = new StringBuilder();
            for (int j = 0; j < ansSizeX; j++) {
                sb.append(ans[j][i]);
            }
            String res = sb.toString().trim();
            if (res.length() > 0)
                out.println(res);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;
        boolean isClosed;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
            isClosed = false;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    isClosed = true;
                    return "0";
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }

    public static void main(String[] arg) {
        try (//InputStream inputStream = new FileInputStream("file.in");
             //OutputStream outputStream = new FileOutputStream("file.out")
             InputStream inputStream = System.in;
             OutputStream outputStream = System.out;
        ) {

            InputReader in = new InputReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            new A().solve(in, out);
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}