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.stream.IntStream;
import java.util.List;
import java.util.stream.Stream;
import java.util.Collection;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.ArrayList;

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

    static class Parens {
        private int maxDeep = 0;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            in.nextLine();
            String parens = in.nextLine();

            List<Parens.Paren> parensList = parseList(parens, 1);
            printParens(parensList, out);
        }

        private void printParens(List<Parens.Paren> parensList, PrintWriter out) {
            for (int i = 0; i < maxHeight(); i++) {
                for (Parens.Paren paren : parensList) {
                    print(paren, i, out);
                }
                out.println();
            }
        }

        private int maxHeight() {
            return 2 * maxDeep + 1;
        }

        private void print(Parens.Paren paren, int row, PrintWriter out) {
            boolean topParent = row == maxHeight() - paren.deep || row == paren.deep - 1;
            boolean midParent = row > paren.deep - 1 && row < maxHeight() - paren.deep;
            for (int i = 0; i < paren.getLength(); i++) {
                if (topParent) {
                    if (i == 0 || i == paren.getLength() - 1) {
                        out.print("+");
                    } else if (i == 1 || i == paren.getLength() - 2) {
                        out.print("-");
                    } else {
                        out.print(" ");
                    }
                } else if (midParent) {
                    if (i == 0 || i == paren.getLength() - 1) {
                        out.print("|");
                        if (i == 0) {
                            paren.children.forEach(child -> print(child, row, out));
                            if (!paren.children.isEmpty()) {
                                i += paren.getLength() - 2;
                            }
                        }
                    } else {
                        out.print(" ");
                    }
                }
            }
        }

        private List<Parens.Paren> parseList(String parens, int deep) {
            List<String> parensString = new ArrayList<>();
            int parensCounter = 1;
            int itt = 1;
            int start = 0;

            while (itt < parens.length()) {
                if (parens.charAt(itt) == '[') parensCounter++;
                if (parens.charAt(itt) == ']') parensCounter--;

                if (parensCounter == 0) {
                    parensString.add(parens.substring(start, itt + 1));
                    start = itt + 1;
                }
                itt++;
            }
            return parensString.stream().map(s -> parse(s, deep)).collect(Collectors.toList());
        }

        private Parens.Paren parse(String parens, int deep) {
            maxDeep = Math.max(maxDeep, deep);

            Parens.Paren result = new Parens.Paren(deep);
            if (!parens.equals("[]"))
                result.children.addAll(parseList(parens.substring(1, parens.length() - 1), deep + 1));
            return result;
        }

        public static class Paren {
            private int length = 0;
            private final int deep;
            private final List<Parens.Paren> children = new ArrayList<>();
            private static final int singleLength = 5;

            public Paren(int deep) {
                this.deep = deep;
            }

            public int getLength() {
                if (length > 0) return length;

                if (children.isEmpty()) {
                    length = singleLength;
                    return length;
                }

                length = 2 + children.stream().mapToInt(Parens.Paren::getLength).sum();
                return length;
            }

        }

    }
}