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 Liavontsi Brechka
 */
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
    @SuppressWarnings("Duplicates")
    class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            char[] brackets = in.next().toCharArray();
            int maxLevel = 0;
            int[] level = new int[n];
            int currentLevel = -1;
            int spaceNeeded = 0;
            for (int i = 0; i < n; i++) {
                if (brackets[i] == '[') level[i] = ++currentLevel;
                else level[i] = currentLevel--;
                maxLevel = Math.max(maxLevel, currentLevel);

                if (i > 0 && brackets[i] == ']' && brackets[i - 1] == '[') spaceNeeded++;
            }

            int rLength = maxLevel * 2 + 3;
            int cLength = spaceNeeded * 3 + n;
            char[][] result = new char[rLength][cLength];
            for (int i = 0; i < rLength; i++) Arrays.fill(result[i], ' ');

            boolean isNextLevel;
            for (int i = 0, column = 0; i < n; i++) {
                if (i > 0 && brackets[i] == ']' && brackets[i - 1] == '[') {
                    fillSpace(result, column, level[i]);
                    column += 3;
                }
                isNextLevel = (i > 0 && brackets[i] == '[' && brackets[i - 1] == '[') ||
                        (i < n - 1 && brackets[i] == ']' && brackets[i + 1] == ']');
                fillColumn(result, column++, level[i], isNextLevel);
            }

            StringBuilder res = new StringBuilder();
            for (int i = 0; i < rLength; i++) {
                for (int j = 0; j < cLength; j++) {
                    res.append(result[i][j]);
                }
                res.append("\n");
            }
            out.print(res);
        }

        private void fillColumn(char[][] grid, int column, int level, boolean isNextLevel) {
            int start = level;
            int end = grid.length - level;
            for (int i = start; i < end; i++) {
                if (i == start || i == end - 1) grid[i][column] = '+';
                else grid[i][column] = '|';
            }

            if (isNextLevel) {
                grid[start - 1][column] = grid[end][column] = '-';
            }
        }

        private void fillSpace(char[][] grid, int column, int level) {
            int end = grid.length - level - 1;
            grid[level][column] = grid[end][column] = grid[level][column + 2] = grid[end][column + 2] = '-';
        }

    }

    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;
        }

    }
}