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 javax.swing.event.ListDataEvent;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class J 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() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());

        }
        return tok.nextToken();
    }

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

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

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

    int[] readIntArray(int size) throws IOException {
        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 _Solution(), "", 128 * (1L << 20)).start();
        new J().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);
        }
    }

    int calc(int[] a) {
        if (a == null) return Integer.MAX_VALUE;
        int res = 0;
        for (int i = 1; i <= a.length; i++) {
            boolean x = false;
            for (int j = 1; j <= a.length; j++) {
                if (j % i == 0 && a[j - 1] % i == 0) x = true;
            }
            if (x) res++;
        }
        return res;
    }

    int[] a;
    int[] best;

    void brut(int pos) {
        if (a.length == pos) {
            if (calc(a) < calc(best)) {
                best = a.clone();
            }
            return;
        }
        for (int i = pos; i < a.length; i++) {
            int t = a[i];
            a[i] = a[pos];
            a[pos] = t;
            brut(pos + 1);
            t = a[i];
            a[i] = a[pos];
            a[pos] = t;
        }
    }

    void solve() throws IOException {
        int n = readInt();
        char[] a = readString().toCharArray();
        int height = 0;
        int balance = 0;
        for (char x : a) {
            if (x == '[') {
                balance++;
            } else {
                balance--;
            }
            height = Math.max(height, balance);
        }
        char[][] matrix = new char[height * 2 + 1][a.length * 3];
        for (char[] x : matrix) Arrays.fill(x, ' ');
        boolean prevClose = true;
        int position = 0;
        int allHeight = height * 2 + 1;
        for (char x : a) {
            if (x == '[') balance++;

            int length = allHeight - balance * 2;
            int from = (allHeight - length) / 2;
            int to = from + length - 1;

            if (x == '[') {
                writeVertical(matrix, position, from, to);
                matrix[from - 1][position + 1] = matrix[to + 1][position + 1] = '-';
                prevClose = false;
                position++;
            } else {
                if (!prevClose) {
                    position += 3;
                }
                writeVertical(matrix, position, from, to);
                matrix[from - 1][position - 1] = matrix[to + 1][position - 1] = '-';
                prevClose = true;
                position++;
            }

            if (x == ']') balance--;
        }

        for (int i = 0; i < allHeight; i++) {
            out.println(new String(matrix[i], 0, position));
        }
    }

    void writeVertical(char[][] matrix, int column, int from, int to) {
        for (int i = from; i <= to; i++) {
            matrix[i][column] = '|';
        }
        matrix[from - 1][column] = '+';
        matrix[to + 1][column] = '+';
    }


}