#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  long long x = 0;
  int ch = getchar(), f = 1;
  while (!isdigit(ch) && (ch != '-') && (ch != EOF)) ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void rt(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10)
    rt(x / 10), putchar(x % 10 + '0');
  else
    putchar(x + '0');
}
const int maxn = 105;
int n, dep, a[maxn], h;
char s[maxn], ans[105][300];
int main() {
  n = rd();
  scanf("%s", s + 1);
  for (int i = int(1); i <= (int)(n); i++) {
    if (s[i] == '[')
      a[i] = ++dep;
    else
      a[i] = dep--;
  }
  for (int i = int(1); i <= (int)(n); i++) h = max(h, a[i] + 1);
  for (int i = int(1); i <= (int)(n); i++) a[i] = h - a[i];
  int col = 1;
  for (int i = int(1); i <= (int)(n); i++) {
    if (s[i] == '[') {
      for (int j = int(h - a[i] + 1); j <= (int)(h + a[i] - 1); j++)
        ans[j][col] = '|';
      ans[h - a[i]][col] = '+';
      ans[h + a[i]][col] = '+';
      ++col;
      ans[h - a[i]][col] = '-';
      ans[h + a[i]][col] = '-';
      if (s[i + 1] == ']') col += 2;
    } else {
      ans[h - a[i]][col] = '-';
      ans[h + a[i]][col] = '-';
      ++col;
      for (int j = int(h - a[i] + 1); j <= (int)(h + a[i] - 1); j++)
        ans[j][col] = '|';
      ans[h - a[i]][col] = '+';
      ans[h + a[i]][col] = '+';
      if (s[i + 1] == '[') col++;
    }
  }
  for (int i = int(1); i <= (int)(h * 2 - 1); i++)
    for (int j = int(1); j <= (int)(col); j++)
      if (!ans[i][j]) ans[i][j] = ' ';
  for (int i = int(1); i <= (int)(h * 2 - 1); i++) puts(ans[i] + 1);
}
