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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;

/**
 * Created by Максим on 11.03.2017.
 */
public class LOL {
    static class Bracket {
        int high;
        boolean open;
        Bracket(int high, boolean open) {
            this.high = high;
            this.open = open;
        }
    }
    static ArrayList<char[]> a;
    static Bracket brackets[];
    static int height;
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(
        new InputStreamReader(System.in)
        );
        in.readLine();
        String raw = in.readLine();
        int current = 0;
        brackets = new Bracket[raw.length()];
        int max = -1;
        for (int i = 0; i < raw.length(); i++) {
            boolean open = raw.charAt(i) == '[';
            if (!open) current--;
            brackets[i] = new Bracket(current, open);
            max = Math.max(max, current);
            if (open) current++;
        }
        for (Bracket bracket : brackets) {
            bracket.high = max - bracket.high;
        }
        height = 2 * max + 3;
        a = new ArrayList<>();
        add();
        add();
        render(0, brackets[0]);
        for (int i = 1; i < brackets.length; i++) {
            Bracket b = brackets[i];
            if (b.open) {
                if (brackets[i - 1].open) {
                    add();
                    render(a.size() - 2, b);
                } else {
                    add();
                    add();
                    render(a.size() - 2, b);
                }
            } else {
                if (brackets[i - 1].open){
                    add();
                    add();
                    add();
                    render(a.size() - 2, b);
                } else {
                    add();
                    render(a.size() - 2, b);
                }
            }
        }
        show();
    }

    private static void show() {

        for (int i = 0; i < height; i++) {
            for (int j = 0; j < a.size(); j++) {
                System.out.print(a.get(j)[i]);
            }
            System.out.println();
        }
    }

    private static void add() {
        a.add(new char[height]);
        Arrays.fill(a.get(a.size() - 1), ' ');
    }
    private static void render(int left, Bracket b) {
        char f[] = a.get(left);
        char s[] = a.get(left + 1);
        if (!b.open) {
            char tmp[] = s;
            s = f;
            f = tmp;
        }
        f[height / 2] = '|';
        for (int i = height / 2 - 1, times = 0; times < b.high; times++, i--) {
            f[i] = '|';
            f[height - i - 1] = '|';
        }
        f[height / 2 - 1 - b.high] = '+';
        s[height / 2 - 1 - b.high] = '-';
        f[height / 2 + 1 + b.high] = '+';
        s[height / 2 + 1 + b.high] = '-';

    }

}