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.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Created by Admin on 11.03.2017.
 */
public class Brackets {

    public static void main(String[] args) {
        new Brackets().run();
    }

    private void run() {
        IO files = new IO();
        int n = files.nextInt();
        char[] c = files.next().toCharArray();
        int[] balance = new int[n];
        int maxBalance = 0;
        for (int i = 0; i < n - 1; i++) {
            balance[i + 1] = balance[i] + (c[i] == '[' ? 1 : -1);
            if (c[i] == ']') {
                maxBalance = Math.max(maxBalance, balance[i + 1]);
            }
        }
        int count = 0;
        for (int i = 1; i < n; i++) {
            if (c[i] == ']' && c[i - 1] == '[') {
                count++;
            }
        }

        char[][] table = new char[n + 3 * count][3 + maxBalance * 2];
        for (char[] aTable : table) {
            Arrays.fill(aTable, ' ');
        }
        int center = table[0].length / 2;
        int idx = 0;
        for (int i = 0; i < n; i++, idx++) {
            if (c[i] == '[') {
                int d = maxBalance - balance[i] + 1;
                for (int h = center - d + 1; h < center + d; h++) {
                    table[idx][h]= '|';
                }
                table[idx][center - d] = '+';
                table[idx][center + d] = '+';
                table[idx + 1][center - d] = '-';
                table[idx + 1][center + d] = '-';
                if (c[i + 1] == ']') {
                    idx += 3;
                }
            } else {
                int d = maxBalance - balance[i] + 2;
                for (int h = center - d + 1; h < center + d; h++) {
                    table[idx][h]= '|';
                }
                table[idx][center - d] = '+';
                table[idx][center + d] = '+';
                table[idx - 1][center - d] = '-';
                table[idx - 1][center + d] = '-';
            }
        }

        for (int i = 0; i < table[0].length; i++) {
            for (int j = 0; j < table.length; j++) {
                files.out.print(table[j][i]);
            }
            files.out.println();
        }
        files.out.close();
    }

    class IO {
        private BufferedReader in;
        private StringTokenizer st;
        PrintWriter out;

        public IO(String name) {
            try {
                in = new BufferedReader(new FileReader(name + ".in"));
                out = new PrintWriter(name + ".out");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        public IO() {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out, true);
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

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

}