#include <bits/stdc++.h>
using namespace std;
char ans[300][300];
string s;
int cnt[300];
int bal[300];
int n, m;
void f(int l, int r, int ll, int rr) {
  if (l + 1 == r) {
    for (int i = 0; i < n / 2 - bal[r]; ++i) {
      ans[n / 2 + i][ll] = '|';
      ans[n / 2 - i][ll] = '|';
      ans[n / 2 + i][rr] = '|';
      ans[n / 2 - i][rr] = '|';
    }
    ans[bal[l] - 1][ll] = '+';
    ans[n - bal[l]][ll] = '+';
    ans[bal[l] - 1][rr] = '+';
    ans[n - bal[l]][rr] = '+';
    ans[bal[l] - 1][ll + 1] = '-';
    ans[n - bal[l]][ll + 1] = '-';
    ans[bal[l] - 1][rr - 1] = '-';
    ans[n - bal[l]][rr - 1] = '-';
    if (ll + 4 != rr) {
      throw 1;
    }
    return;
  }
  int q = l;
  int bl = 0;
  for (q = l; q <= r; ++q) {
    if (s[q] == '[') {
      ++bl;
    } else {
      --bl;
    }
    if (bl == 0) {
      break;
    }
  }
  if (q == r) {
    for (int i = 0; i < n / 2 - bal[r]; ++i) {
      ans[n / 2 + i][ll] = '|';
      ans[n / 2 - i][ll] = '|';
      ans[n / 2 + i][rr] = '|';
      ans[n / 2 - i][rr] = '|';
    }
    ans[bal[l] - 1][ll] = '+';
    ans[n - bal[l]][ll] = '+';
    ans[bal[l] - 1][rr] = '+';
    ans[n - bal[l]][rr] = '+';
    ans[bal[l] - 1][ll + 1] = '-';
    ans[n - bal[l]][ll + 1] = '-';
    ans[bal[l] - 1][rr - 1] = '-';
    ans[n - bal[l]][rr - 1] = '-';
    f(l + 1, r - 1, ll + 1, rr - 1);
    return;
  }
  int qq = ll + q - l + (cnt[q] - cnt[l]) * 3;
  f(l, q, ll, qq);
  f(q + 1, r, qq + 1, rr);
}
int main() {
  memset(ans, ' ', sizeof(ans));
  int qwe;
  cin >> qwe;
  cin >> s;
  int bl = 0;
  int mx = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '[') {
      ++bl;
      mx = max(mx, bl);
    } else {
      if (s[i - 1] == '[') {
        cnt[i] = 1;
      }
      --bl;
    }
    bal[i] = bl;
    cnt[i] += i > 0 ? cnt[i - 1] : 0;
  }
  n = mx * 2 + 1;
  m = s.size() + cnt[s.size() - 1] * 3;
  f(0, s.size() - 1, 0, m - 1);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cout << ans[i][j];
    }
    cout << endl;
  }
}
