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 com.sun.org.apache.bcel.internal.generic.NEW;

import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) throws Exception {
        MyReader reader = new MyReader(System.in);
        MyWriter writer = new MyWriter(System.out);
        int n = reader.nextInt();
        String s = reader.nextString();
        int b = 0;
        int max = 0;
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == '[') {
                b++;
                max = Math.max(max, b);
            } else {
                b--;
            }
        }
        max = max * 2 + 1;
        char[][] c = new char[300][max];
        for (int i = 0; i < 300; i++) {
            for (int j = 0; j < max; j++) {
                c[i][j] = ' ';
            }
        }
        int x = 0;
        int y = 0;
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == ']') {
                y--;
                if (s.charAt(i - 1) == '[') {
                    x += 3;
                }
            }
            c[x][y] = c[x][max - y - 1] = '+';
            for (int j = y + 1; j < max - y - 1; j++) {
                c[x][j] = '|';
            }
            if (s.charAt(i) == '[') {
                c[x + 1][y] = c[x + 1][max - y - 1] = '-';
                y++;
            } else {
                c[x - 1][y] = c[x - 1][max - y - 1] = '-';
            }
            x++;
        }
        for (int i = 0; i < max; i++) {
            for (int j = 0; j < x; j++) {
                writer.print(c[j][i]);
            }
            writer.println();
        }
        writer.close();
    }

    static class MyReader {

        final BufferedInputStream in;
        final int bufSize = 1 << 16;
        final byte buf[] = new byte[bufSize];
        int i = bufSize;
        int k = bufSize;
        final StringBuilder str = new StringBuilder();

        MyReader(InputStream in) {
            this.in = new BufferedInputStream(in, bufSize);
        }

        int nextInt() throws IOException {
            return (int) nextLong();
        }

        int[] nextIntArray(int n) throws IOException {
            int[] m = new int[n];
            for (int i = 0; i < n; i++) {
                m[i] = nextInt();
            }
            return m;
        }

        int[][] nextIntMatrix(int n, int m) throws IOException {
            int[][] a = new int[n][0];
            for (int j = 0; j < n; j++) {
                a[j] = nextIntArray(m);
            }
            return a;
        }

        long nextLong() throws IOException {
            int c;
            long x = 0;
            boolean sign = true;
            while ((c = nextChar()) <= 32) ;
            if (c == '-') {
                sign = false;
                c = nextChar();
            }
            if (c == '+') {
                c = nextChar();
            }
            while (c >= '0') {
                x = x * 10 + (c - '0');
                c = nextChar();
            }
            return sign ? x : -x;
        }

        long[] nextLongArray(int n) throws IOException {
            long[] m = new long[n];
            for (int i = 0; i < n; i++) {
                m[i] = nextLong();
            }
            return m;
        }

        String nextString() throws IOException {
            int c;
            str.setLength(0);
            while ((c = nextChar()) <= 32 && c != -1) ;
            if (c == -1) {
                return null;
            }
            while (c > 32) {
                str.append((char) c);
                c = nextChar();
            }
            return str.toString();
        }

        String[] nextStringArray(int n) throws IOException {
            String[] m = new String[n];
            for (int i = 0; i < n; i++) {
                m[i] = nextString();
            }
            return m;
        }

        int nextChar() throws IOException {
            if (i == k) {
                k = in.read(buf, 0, bufSize);
                i = 0;
            }
            return i >= k ? -1 : buf[i++];
        }
    }

    static class MyWriter {

        final BufferedOutputStream out;
        final int bufSize = 1 << 16;
        final byte buf[] = new byte[bufSize];
        int i = 0;
        final byte c[] = new byte[30];
        static final String newLine = System.getProperty("line.separator");

        MyWriter(OutputStream out) {
            this.out = new BufferedOutputStream(out, bufSize);
        }

        void print(long x) throws IOException {
            int j = 0;
            if (i + 30 >= bufSize) {
                flush();
            }
            if (x < 0) {
                buf[i++] = (byte) ('-');
                x = -x;
            }
            while (j == 0 || x != 0) {
                c[j++] = (byte) (x % 10 + '0');
                x /= 10;
            }
            while (j-- > 0)
                buf[i++] = c[j];
        }

        void print(int[] m) throws Exception {
            for (int a : m) {
                print(a);
                print(' ');
            }
        }

        void print(long[] m) throws Exception {
            for (long a : m) {
                print(a);
                print(' ');
            }
        }

        void print(String s) throws IOException {
            for (int i = 0; i < s.length(); i++) {
                print(s.charAt(i));
            }
        }

        void print(char x) throws IOException {
            if (i == bufSize) {
                flush();
            }
            buf[i++] = (byte) x;
        }

        void print(char[] m) throws Exception {
            for (char c : m) {
                print(c);
            }
        }

        void println(String s) throws IOException {
            print(s);
            println();
        }

        void println() throws IOException {
            print(newLine);
        }

        void flush() throws IOException {
            out.write(buf, 0, i);
            i = 0;
        }

        void close() throws IOException {
            flush();
            out.close();
        }
    }
}