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;
char ans[300][300];
string s;
int cnt[300];
int bal[300];
int n, m;
void f(int l, int r, int ll, int rr) {
  if (l + 1 == r) {
    for (int i = 0; i < n / 2 - bal[r]; ++i) {
      ans[n / 2 + i][ll] = '|';
      ans[n / 2 - i][ll] = '|';
      ans[n / 2 + i][rr] = '|';
      ans[n / 2 - i][rr] = '|';
    }
    ans[bal[l] - 1][ll] = '+';
    ans[n - bal[l]][ll] = '+';
    ans[bal[l] - 1][rr] = '+';
    ans[n - bal[l]][rr] = '+';
    ans[bal[l] - 1][ll + 1] = '-';
    ans[n - bal[l]][ll + 1] = '-';
    ans[bal[l] - 1][rr - 1] = '-';
    ans[n - bal[l]][rr - 1] = '-';
    if (ll + 4 != rr) {
      throw 1;
    }
    return;
  }
  int q = l;
  int bl = 0;
  for (q = l; q <= r; ++q) {
    if (s[q] == '[') {
      ++bl;
    } else {
      --bl;
    }
    if (bl == 0) {
      break;
    }
  }
  if (q == r) {
    for (int i = 0; i < n / 2 - bal[r]; ++i) {
      ans[n / 2 + i][ll] = '|';
      ans[n / 2 - i][ll] = '|';
      ans[n / 2 + i][rr] = '|';
      ans[n / 2 - i][rr] = '|';
    }
    ans[bal[l] - 1][ll] = '+';
    ans[n - bal[l]][ll] = '+';
    ans[bal[l] - 1][rr] = '+';
    ans[n - bal[l]][rr] = '+';
    ans[bal[l] - 1][ll + 1] = '-';
    ans[n - bal[l]][ll + 1] = '-';
    ans[bal[l] - 1][rr - 1] = '-';
    ans[n - bal[l]][rr - 1] = '-';
    f(l + 1, r - 1, ll + 1, rr - 1);
    return;
  }
  int qq = ll + q - l + (cnt[q] - cnt[l]) * 3;
  f(l, q, ll, qq);
  f(q + 1, r, qq + 1, rr);
}
int main() {
  memset(ans, ' ', sizeof(ans));
  int qwe;
  cin >> qwe;
  cin >> s;
  int bl = 0;
  int mx = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '[') {
      ++bl;
      mx = max(mx, bl);
    } else {
      if (s[i - 1] == '[') {
        cnt[i] = 1;
      }
      --bl;
    }
    bal[i] = bl;
    cnt[i] += i > 0 ? cnt[i - 1] : 0;
  }
  n = mx * 2 + 1;
  m = s.size() + cnt[s.size() - 1] * 3;
  f(0, s.size() - 1, 0, m - 1);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << ans[i][j];
    }
    cout << endl;
  }
}