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.Arrays;
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
 *
 * @author Vadim Semenov
 */
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 final class TaskD {
        public void solve(int __, InputReader in, PrintWriter out) {
            int length = in.nextInt();
            char[] sequence = in.next().toCharArray();
            int maxBalance = 0;
            int balance = 0;
            int pairsQty = 0;
            for (int i = 0; i < length; ++i) {
                if (sequence[i] == '[') {
                    ++balance;
                    maxBalance = Math.max(maxBalance, balance);
                } else if (sequence[i] == ']') {
                    --balance;
                    if (sequence[i - 1] == '[') ++pairsQty;
                } else assert false : "WTF?!: " + sequence[i];
                assert balance >= 0;
            }
            char[][] ascii = new char[2 * maxBalance + 1][length + pairsQty * 3];
            for (char[] row : ascii) Arrays.fill(row, ' ');
            assert balance == 0;
            for (int i = 0, currentColumn = 0; i < length; ++i, ++currentColumn) {
                int bottom = ascii.length - 1 - balance;
                if (sequence[i] == ']') {
                    if (sequence[i - 1] == '[') currentColumn += 3;
                    --balance;
                    bottom = ascii.length - 1 - balance;
                    ascii[balance][currentColumn - 1] = ascii[bottom][currentColumn - 1] = '-';
                }
                ascii[balance][currentColumn] = '+';
                for (int row = balance + 1; row < bottom; ++row) {
                    ascii[row][currentColumn] = '|';
                }
                ascii[bottom][currentColumn] = '+';
                if (sequence[i] == '[') {
                    ascii[balance][currentColumn + 1] = ascii[bottom][currentColumn + 1] = '-';
                    ++balance;
                }
            }
            for (char[] row : ascii) out.println(row);
        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

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

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

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

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}