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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int pi[111], mx, n;
vector<string> v;
vector<int> pt;
string seq;
char grid[1005][1005];
void getPi() {
  string t = "";
  int i, j, k, l, m, vl = 0, i1;
  stack<char> st;
  for (i = 0; i < (int)n; i++) {
    t = t + seq[i];
    if (seq[i] == '[') {
      vl++;
      pi[i] = vl;
      mx = max(mx, vl);
      st.push(seq[i]);
    } else {
      pi[i] = vl;
      vl--;
      st.pop();
      if ((int)st.size() == 0) {
        v.push_back(t);
        t = "";
      }
    }
  }
  k = 0;
  for (i = 0; i < (int)v.size(); i++) {
    for (j = 0; j < v[i].size(); j++) {
      pi[k + j] = mx - pi[k + j] + 1;
    }
    k += (v[i].size());
  }
  for (i = 0; i <= 1000; i++) {
    for (j = 0; j <= 1000; j++) {
      grid[i][j] = ' ';
    }
  }
  i = 0;
  for (i1 = 0; i1 < n; i1++) {
    k = pi[i1] * 2 - 1;
    m = mx - pi[i1];
    if (seq[i1] == '[') {
      grid[i][m] = '+';
      grid[i + 1][m] = '-';
      for (j = m + 1, l = 0; l < k; j++, l++) {
        grid[i][j] = '|';
      }
      grid[i][j] = '+';
      grid[i + 1][j] = '-';
      i++;
    } else {
      if (seq[i1 - 1] == '[')
        i++;
      else
        i -= 2;
      i++;
      grid[i][m] = '-';
      grid[i + 1][m] = '+';
      for (j = m + 1, l = 0; l < k; j++, l++) {
        grid[i + 1][j] = '|';
      }
      grid[i][j] = '-';
      grid[i + 1][j] = '+';
      i++;
      i++;
    }
  }
  for (k = 0; k < mx * 2 + 1; k++) {
    for (j = 0; j < i; j++) {
      cout << grid[j][k];
    }
    cout << "\n";
  }
}
int main() {
  cin >> n;
  cin >> seq;
  getPi();
  return 0;
}