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:216000000")
using namespace std;
const long long MAX = numeric_limits<long long>::max();
const long long MIN = numeric_limits<long long>::min();
const double PI = 3.14159265358979;
const long long MOD = 1000000007LL;
template <class T>
ostream& operator<<(ostream& out, vector<T>& v) {
  for (int i = 0; i < v.size(); ++i) out << v[i] << " ";
  return out;
}
template <class T>
istream& operator>>(istream& in, vector<T>& v) {
  for (int i = 0; i < v.size(); ++i) in >> v[i];
  return in;
}
template <class T>
T lexical_cast(string& s) {
  stringstream ss(s);
  T t;
  ss >> t;
  return t;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long cdiv(long long a, long long b) {
  return (a % b) ? (a / b + 1) : (a / b);
}
template <class Cont>
void sort(Cont& c) {
  sort(begin(c), end(c));
}
template <class Cont>
void reverse(Cont& c) {
  reverse(begin(c), end(c));
}
vector<int> order;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  s = "]" + s;
  vector<int> h(n + 1);
  int minh = 0, maxh = 0;
  int len = 0;
  for (int i = 1; i <= n; ++i) {
    if (s[i - 1] != s[i]) {
      h[i] = h[i - 1];
      if (s[i] == ']') len += 3;
    } else if (s[i] == '[') {
      h[i] = h[i - 1] - 1;
    } else {
      h[i] = h[i - 1] + 1;
    }
    len++;
    minh = min(minh, h[i]);
    maxh = max(maxh, h[i]);
  }
  for (int i = 0; i <= n; ++i) {
    h[i] -= minh;
  }
  maxh -= minh;
  vector<vector<char>> field(2 * maxh + 3, vector<char>(len, ' '));
  int col = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = maxh - h[i]; j <= maxh + h[i] + 1; ++j) {
      field[j][col] = '|';
    }
    field[maxh - h[i]][col] = '+';
    field[maxh + h[i] + 2][col] = '+';
    if (s[i] == '[') {
      field[maxh - h[i]][col + 1] = '-';
      field[maxh + h[i] + 2][col + 1] = '-';
    } else {
      field[maxh - h[i]][col - 1] = '-';
      field[maxh + h[i] + 2][col - 1] = '-';
    }
    if (i < n && s[i] == '[' && s[i + 1] == ']') {
      col += 4;
    } else {
      col++;
    }
  }
  for (int i = 0; i < field.size(); ++i) {
    for (int j = 0; j < field[i].size(); ++j) {
      cout << field[i][j];
    }
    cout << endl;
  }
}