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.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;

/**
 * Created by Firеfly on 1/1/2017.
 */
public class Task {
    public static void main(String[] args) throws IOException {
        Emaxx emaxx = new Emaxx();
    }
}


class Emaxx {
    FScanner fs;
    PrintWriter pw;

    Emaxx() throws IOException {
        fs = new FScanner(new InputStreamReader(System.in));
        // pw = new PrintWriter(new FileWriter("arithnumbers.out"));
        //  fs = new FScanner(new FileReader("C:\\Users\\Firеfly\\Desktop\\New Text Document.txt"));
        //     fs = new FScanner(new FileReader("input.txt"));;
        //       pw = new PrintWriter("output.txt");
        PrintWriter pw = new PrintWriter(System.out);
        int n = fs.nextInt();
        char[] mas = new char[n];
        for (int i = 0; i < n; i++)
            mas[i] = fs.nextChar();
        int deep = 0;
        int currdeep = 0;
        for (int i = 0; i < n; i++) {
            if (mas[i] == '[')
                currdeep++;
            else currdeep--;
            if (currdeep > deep)
                deep = currdeep;
        }
        deep++;
        char[][] answer = new char[deep * 2 - 1][1000];
        for (int i = 0; i < answer.length; i++)
            for (int j = 0; j < 1000; j++)
                answer[i][j] = ' ';
        currdeep = 0;
        int currpos = 0;
        for (int i = 0; i < n; i++) {
            if (mas[i] == '[') {
                if (answer[currdeep][currpos] != ' ')
                    currpos++;
                answer[currdeep][currpos] = '+';
                answer[currdeep][currpos + 1] = '-';
                answer[answer.length - currdeep - 1][currpos] = '+';
                answer[answer.length - currdeep - 1][currpos + 1] = '-';
                for (int j = currdeep + 1; j < answer.length - currdeep - 1; j++)
                    answer[j][currpos] = '|';
                currdeep++;
                currpos++;
            } else {
                currdeep--;
                if (answer[currdeep][currpos] != ' ')
                    currpos += 2;
                answer[currdeep][currpos] = '-';
                answer[currdeep][currpos + 1] = '+';
                answer[answer.length - currdeep - 1][currpos] = '-';
                answer[answer.length - currdeep - 1][currpos + 1] = '+';
                for (int j = currdeep + 1; j < answer.length - currdeep - 1; j++)
                    answer[j][currpos + 1] = '|';
                currpos++;
            }
        }
        int lenght = 999;
        while (answer[0][lenght] == ' ')
            lenght--;
        for (int i = 0; i < answer.length; i++) {
            for (int j = 0; j <= lenght; j++)
                System.out.print(answer[i][j]);
            System.out.println();
        }
        pw.close();
    }
}

class FScanner {
    BufferedReader br;
    StringTokenizer st;
    FScanner(InputStreamReader isr) {
        br = new BufferedReader(isr);
    }

    FScanner(FileReader fr) {
        br = new BufferedReader(fr);
    }

    String nextToken() throws IOException{
        while (st == null || !st.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null)
                return null;
            st = new StringTokenizer(s);
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextLine() throws IOException {
        return br.readLine();
    }

    char nextChar() throws IOException {
        return (char) br.read();
    }

}

class Pair implements Comparable<Pair> {
    int x, y;
    Pair(int x1, int y1) {
        x = x1;
        y = y1;
    }

    @Override
    public int compareTo(Pair o) {
        return Integer.compare(x, o.x);
    }
}