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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String sequence = in.next();
            int[] bal = new int[sequence.length()];
            bal[0] = 1;
            for (int i = 1; i < sequence.length(); i++) {
                bal[i] = bal[i - 1];
                if (sequence.charAt(i) == '[') {
                    bal[i]++;
                } else if (sequence.charAt(i) == ']') {
                    bal[i]--;
                }
            }
            int maxBal = 0;
            for (int i = 0; i < bal.length; i++) {
                maxBal = Math.max(maxBal, bal[i]);
            }
            int maxHeight = 2 * maxBal + 1;
            int[] height = new int[sequence.length()];
            for (int i = 0; i < sequence.length(); i++) {
                height[i] = maxHeight - 2 * bal[i];
                if (sequence.charAt(i) == ']') {
                    height[i] -= 2;
                }
            }
            char[][] display = new char[maxHeight][n * 3];
            int used = 0;
            for (int i = 0; i < sequence.length(); i++) {
                if (sequence.charAt(i) == '[') {
                    used += drawLeft(display, maxHeight, height[i], used);
                } else {
                    boolean space = false;
                    if (sequence.charAt(i - 1) == '[') space = true;
                    used += drawRight(display, maxHeight, height[i], used, space);
                }
            }
            out.println(draw(display, used));
        }

        int drawLeft(char[][] display, int maxHeight, int height, int used) {
            int first = (maxHeight - height) / 2;
            int last = (maxHeight + height) / 2;
            display[first - 1][used] = '+';
            display[first - 1][used + 1] = '-';
            for (int j = first; j < last; j++) {
                display[j][used] = '|';
            }
            display[last][used] = '+';
            display[last][used + 1] = '-';
            return 1;
        }

        int drawRight(char[][] display, int maxHeight, int height, int used, boolean space) {
            int first = (maxHeight - height) / 2;
            int last = (maxHeight + height) / 2;
            display[first - 1][used + (space ? 3 : 0)] = '+';
            display[first - 1][used + (space ? 2 : -1)] = '-';
            for (int j = first; j < last; j++) {
                display[j][used + (space ? 3 : 0)] = '|';
            }
            display[last][used + (space ? 3 : 0)] = '+';
            display[last][used + (space ? 2 : -1)] = '-';
            return space ? 4 : 1;
        }

        String draw(char[][] display, int width) {
            StringBuilder sb = new StringBuilder();
            for (char[] line : display) {
                for (int i = 0; i < width; i++) {
                    if (line[i] == 0) {
                        sb.append(' ');
                    } else {
                        sb.append(line[i]);
                    }
                }
                sb.append('\n');
            }
            return sb.toString();
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

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

    }
}