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;
const long long N = 105;
long long A[N];
string v[3 * N];
string t;
void pub(string &s, long long i, char c) {
  if (i == 0)
    s.push_back(c);
  else if (t[i - 1] == '[')
    s[s.size() - 1] = c;
  else
    s.push_back(c);
}
void solve() {
  long long n;
  stack<long long> s;
  cin >> n;
  cin >> t;
  long long dep = 0;
  for (__typeof(((long long)t.size() - 1)) i = (0);
       i <= ((long long)t.size() - 1); i++) {
    if (t[i] == '[') {
      if (s.empty()) {
        s.push(0);
        A[i] = s.top();
      } else {
        s.push(s.top() + 1);
        A[i] = s.top();
      }
      dep = max(dep, s.top());
    } else {
      A[i] = s.top();
      s.pop();
    }
  }
  long long c = (2 * dep + 1 + 2) / 2;
  long long upMax = 0;
  long long downMax = 2 * (dep) + 2;
  for (__typeof(((long long)t.size() - 1)) i = (0);
       i <= ((long long)t.size() - 1); i++) {
    long long h = 2 * (dep - A[i]) + 1;
    if (t[i] == ']') {
      long long q = dep - A[i];
      if (t[i - 1] == '[') {
        for (__typeof((downMax)) j = (upMax); j <= (downMax); j++) {
          v[j].push_back(' ');
          v[j].push_back(' ');
        }
      }
      v[c - q - 1][v[c - q - 1].size() - 1] = '-';
      v[c - q - 1].push_back('+');
      v[c + q + 1][v[c + q + 1].size() - 1] = '-';
      v[c + q + 1].push_back('+');
      for (long long j = c - q; j <= c + q; j++) {
        v[j].push_back('|');
      }
      for (long long j = c - q - 2; j >= upMax; j--) v[j].push_back(' ');
      for (long long j = c + q + 2; j <= downMax; j++) v[j].push_back(' ');
    } else {
      pub(v[c], i, '|');
      long long q = dep - A[i];
      long long j = c - 1;
      for (; q > 0; q--) {
        pub(v[j], i, '|');
        j--;
      }
      pub(v[j], i, '+');
      v[j].push_back('-');
      long long x1 = j;
      j--;
      if (i - 1 < 0 or t[i - 1] == ']') {
        for (; j >= upMax; j--) pub(v[j], i, ' ');
      }
      j = c + 1;
      q = dep - A[i];
      for (; q > 0; q--) {
        pub(v[j], i, '|');
        j++;
      }
      pub(v[j], i, '+');
      v[j].push_back('-');
      long long x2 = j;
      j++;
      if (i - 1 < 0 or t[i - 1] == ']') {
        for (; j <= downMax; j++) v[j].push_back(' ');
      }
      for (long long j = upMax; j <= downMax; j++) {
        if (j == x1 or j == x2) continue;
        v[j].push_back(' ');
      }
    }
  }
  for (long long i = upMax; i <= downMax; i++) cout << v[i] << '\n';
}
signed main() {
  long long t;
  ios_base::sync_with_stdio(false);
  t = 1;
  while (t--) solve();
  return 0;
}