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>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
int n, imax, jmax;
string s;
int mxL;
char A[300][300];
int t;
void draw(int di, int dj, int hight, int width) {
  A[di][dj] = '+';
  A[di][dj + 1] = '-';
  A[di][dj + width - 1] = '+';
  A[di][dj + width - 2] = '-';
  A[di + hight - 1][dj] = '+';
  A[di + hight - 1][dj + 1] = '-';
  A[di + hight - 1][dj + width - 1] = '+';
  A[di + hight - 1][dj + width - 2] = '-';
  for (int i = di + 1; i < di + hight - 1; ++i) {
    A[i][dj] = '|';
    A[i][dj + width - 1] = '|';
  }
  if (di + hight - 1 > imax) imax = di + hight - 1;
  if (dj + width - 1 > jmax) jmax = dj + width - 1;
}
int mxLevel(int i) {
  int level = 0;
  int open = 0;
  for (; i < n; ++i) {
    if (s[i] == ']') {
      open--;
    }
    if (s[i] == '[') {
      open++;
      level = max(level, open);
    }
  }
  return level;
}
pair<int, int> fun(int di, int dj, int level) {
  int hight = 0;
  int width = 0;
  int inLev = level;
  for (; t < n; ++t) {
    if (s[t] == '[') {
      t++;
      pair<int, int> f;
      if (width == 0) {
        f = fun(di + 1, dj + 1, ++inLev);
        hight += f.second;
      } else {
        f = fun(di + 1, dj + width + 1, inLev);
        hight = f.second;
      }
      width += f.first;
      continue;
    }
    if (s[t] == ']') break;
  }
  if (width != 0 && hight != 0) {
    width += 2;
    hight += 2;
  } else {
    width = 5;
    if (level < mxL) {
      hight = 3 + (mxL - level) * 2;
    } else
      hight = 3;
  }
  if (di != -1 && dj != -1) draw(di, dj, hight, width);
  return make_pair(width, hight);
}
inline void out() {
  for (int i = 0; i <= imax; ++i) {
    for (int j = 0; j <= jmax; ++j) {
      if (A[i][j] == '\0')
        cout << " ";
      else
        cout << A[i][j];
    }
    cout << endl;
  }
}
int main() {
  cin >> n >> s;
  mxL = mxLevel(0);
  fun(-1, -1, 0);
  out();
  return 0;
}