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 int MAX_N = 1005;
char a[2 * MAX_N][MAX_N];
int deep[MAX_N];
int main() {
  for (int i = 0; i < 2 * MAX_N; i++)
    for (int j = 0; j < MAX_N; j++) a[i][j] = ' ';
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cnt = 0;
  int mx_cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '[') {
      cnt++;
      mx_cnt = max(mx_cnt, cnt);
      deep[i] = cnt;
    } else {
      deep[i] = cnt;
      cnt--;
    }
  }
  int max_h = 1 + mx_cnt * 2;
  int max_w = 0;
  int x = 0, y = 0;
  for (int i = 0; i < n; i++) {
    int now_h = 1 + (mx_cnt - deep[i] + 1) * 2;
    if (s[i] == '[') {
      a[x][y] = a[x + now_h - 1][y] = '+';
      a[x][y + 1] = a[x + now_h - 1][y + 1] = '-';
      for (int k = x + 1; k < x + now_h - 1; k++) a[k][y] = '|';
      max_w = max(max_w, y + 1);
      if (deep[i + 1] == deep[i])
        y += 3;
      else {
        x++;
        y++;
      }
    } else {
      a[x][y] = a[x + now_h - 1][y] = '-';
      a[x][y + 1] = a[x + now_h - 1][y + 1] = '+';
      for (int k = x + 1; k < x + now_h - 1; k++) a[k][y + 1] = '|';
      max_w = max(max_w, y + 1);
      if (i == n - 1) break;
      if (deep[i + 1] == deep[i])
        y += 2;
      else {
        y += 1;
        x--;
      }
    }
  }
  for (int i = 0; i < max_h; i++) {
    for (int j = 0; j <= max_w; j++) cout << a[i][j];
    cout << "\n";
  }
  return 0;
}