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.awt.Frame;
import java.io.*;
import java.lang.ProcessBuilder.Redirect;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;

public class CF_Task implements Runnable {

    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer tok = new StringTokenizer("");

    private void init() throws FileNotFoundException {
        Locale.setDefault(Locale.US);
        String fileName = "";
        if (ONLINE_JUDGE && fileName.isEmpty()) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            if (fileName.isEmpty()) {
                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");
            }
        }
    }

    String readString() {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    long readLong() {
        return Long.parseLong(readString());
    }

    double readDouble() {
        return Double.parseDouble(readString());
    }

    int[] readIntArray(int size) {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = readInt();
        }
        return a;
    }

    public static void main(String[] args) {
        // new Thread(null, new A(), "", 128 * (1L << 20)).start();
        new CF_Task().run();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    @Override
    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            init();
            solve();
            out.close();
            time();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    private int max;

    int[] level(int x[]) {
        /*
         * // посмотрим что там for (int i = 0; i < x.length; i++) {
         * out.print(x[i] + " "); }
         */
        // ищем максимум в массиве
        max = 0;
        for (int i = 0; i < x.length; i++) {
            max = Math.max(x[i], max);
        }
        // посмотрим что там
        // out.println();
        for (int i = 0; i < x.length; i++) {
            x[i] = max - x[i];
            // out.print(x[i] + " ");
        }
        return x;
    }

    int lengthString(String s) {
        int length = 1;
        for (int i = 0; i < s.length() - 1; i++) {
            if (s.charAt(i) == '[' && s.charAt(i + 1) == '[') {
                length++;
            }
            if (s.charAt(i) == '[' && s.charAt(i + 1) == ']') {
                length += 4;
            }
            if (s.charAt(i) == ']' && s.charAt(i + 1) == '[') {
                length++;
            }
            if (s.charAt(i) == ']' && s.charAt(i + 1) == ']') {
                length++;
            }
        }
        return length;
    }

    void printCharArr(char[][] c) {
        for (int i = 0; i < c[0].length; i++) {
            for (int j = 0; j < c.length; j++) {
                if(c[j][i] == 0){
                    out.print(" ");
                }else {
                    out.print(c[j][i]);
                }
            }
            if (i != c[0].length - 1)
                out.println();
        }
    }

    private void solve() {
        readInt();
        String s = readString();
        int[] x = new int[s.length()];
        x[0] = 0;
        for (int i = 0; i < s.length() - 1; i++) {
            if (s.charAt(i) == '[' && s.charAt(i + 1) == '[') {
                x[i + 1] = x[i] + 1;
            }
            if (s.charAt(i) == '[' && s.charAt(i + 1) == ']') {
                x[i + 1] = x[i];
            }
            if (s.charAt(i) == ']' && s.charAt(i + 1) == '[') {
                x[i + 1] = x[i];
            }
            if (s.charAt(i) == ']' && s.charAt(i + 1) == ']') {
                x[i + 1] = x[i] - 1;
            }
        }
        x = level(x);
        char c[][] = new char[lengthString(s)][2 * max + 3];

        int middle = max + 1;
        int it = 0;// по массиву "с"
        for (int i = 0; i < s.length(); i++, it++) {// по длине
            // c[i][middle] = '|';
            if (i > 0 && s.charAt(i - 1) == '[' && s.charAt(i) == ']') {
                it += 3;
            }
            for (int j = 0; j < x[i] + 1; j++) {// от центра расходимся
                c[it][middle + j] = '|';
                c[it][middle - j] = '|';
            }
            c[it][middle + x[i] + 1] = '+';
            c[it][middle - x[i] - 1] = '+';
            if (s.charAt(i) == '[') {
                c[it + 1][middle + x[i] + 1] = '-';
                c[it + 1][middle - x[i] - 1] = '-';
            }
            if (s.charAt(i) == ']') {
                c[it - 1][middle + x[i] + 1] = '-';
                c[it - 1][middle - x[i] - 1] = '-';
            }
        }
        printCharArr(c);

    }
}