#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int mas[100];
int cur, mx;
string ans[150];
int sz;
int spc = 0;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '[') {
      mas[i] = cur++;
    } else {
      mas[i] = --cur;
    }
    mx = max(mx, cur);
  }
  for (int i = 0; i < n; i++) mas[i] = mx - mas[i];
  sz = (mx * 2 - 1) + 2;
  int mxlen = 0, mns = 0;
  int last = 0;
  for (int i = 0; i < sz; i++) ans[i].assign(300, ' ');
  for (int i = 0; i < n; i++) {
    if (s[i] == '[') {
      ans[sz / 2][last] = '|';
      for (int j = 1; j <= mas[i] - 1; j++)
        ans[sz / 2 + j][last] = ans[sz / 2 - j][last] = '|';
      ans[sz / 2 + mas[i]][last] = ans[sz / 2 - mas[i]][last] = '+';
      ans[sz / 2 + mas[i]][last + 1] = ans[sz / 2 - mas[i]][last + 1] = '-';
      if (s[i + 1] == '[')
        last++;
      else
        last += 3;
    } else {
      ans[sz / 2][last + 1] = '|';
      for (int j = 1; j <= mas[i] - 1; j++)
        ans[sz / 2 + j][last + 1] = ans[sz / 2 - j][last + 1] = '|';
      ans[sz / 2 + mas[i]][last + 1] = ans[sz / 2 - mas[i]][last + 1] = '+';
      ans[sz / 2 + mas[i]][last] = ans[sz / 2 - mas[i]][last] = '-';
      if (i < n) {
        if (s[i + 1] == ']')
          last++;
        else
          last += 2;
      }
      mxlen = last;
    }
  }
  for (int i = 0; i < sz; i++) {
    while (ans[i].length() > mxlen) ans[i].pop_back();
  }
  for (int i = 0; i < sz; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}
