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>
const long long int mrx = 1e6 + 5, M = 1e9 + 7, dm = 1e3 + 5;
long long int mx = -1e18, mn = 1e18;
using namespace std;
long long int n, k;
string s, d[dm];
long long int id1, id2;
int main() {
  cin >> n >> s;
  for (long long int i = 0; i < s.size(); ++i) {
    if (s[i] == '[') {
      k++;
      mx = max(k, mx);
    } else {
      k--;
    }
  }
  mx *= 2;
  mx--;
  d[0] += "+-";
  d[mx + 1] += "+-";
  for (long long int i = 1; i < mx + 1; ++i) {
    d[i] += "|";
  }
  id1 = 0;
  id2 = mx + 1;
  for (long long int j = 1; j < s.size(); ++j) {
    if (s[j - 1] == '[' && s[j] == '[') {
      for (long long int i = 0; i < id1 + 1; ++i) {
        d[i] += " ";
      }
      d[id1 + 1] += "+-";
      for (long long int i = id1 + 2; i < id2 - 1; ++i) {
        d[i] += "|";
      }
      d[id2 - 1] += "+-";
      for (long long int i = id2; i < mx + 2; ++i) {
        d[i] += " ";
      }
      id1++;
      id2--;
    } else if (s[j - 1] == '[' && s[j] == ']') {
      for (long long int i = 0; i < id1; ++i) {
        d[i] += "  ";
      }
      d[id1] += " -+";
      for (long long int i = id1 + 1; i < id2; ++i) {
        d[i] += "   |";
      }
      d[id2] += " -+";
      for (long long int i = id2 + 1; i < mx + 2; ++i) {
        d[i] += "  ";
      }
    } else if (s[j - 1] == ']' && s[j] == '[') {
      for (long long int i = 0; i < id1; ++i) {
        d[i] += "   ";
      }
      d[id1] += "+-";
      for (long long int i = id1 + 1; i < id2; ++i) {
        d[i] += '|';
      }
      d[id2] += "+-";
      for (long long int i = id2 + 1; i < mx + 2; ++i) {
        d[i] += "   ";
      }
    } else {
      for (long long int i = 0; i < id1 - 1; ++i) {
        d[i] += " ";
      }
      d[id1 - 1] += "-+";
      for (long long int i = id1; i < id2 + 1; ++i) {
        d[i] += "|";
      }
      d[id2 + 1] += "-+";
      for (long long int i = id2 + 2; i < mx + 2; ++i) {
        d[i] += " ";
      }
      id1--;
      id2++;
    }
  }
  for (long long int i = 0; i < mx + 2; ++i) {
    cout << d[i];
    cout << "\n";
  }
  return 0;
}