#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300;
char c[MAXN][MAXN];
int main() {
  for (int i = 0; i < MAXN; i++)
    for (int j = 0; j < MAXN; j++) c[i][j] = ' ';
  int n, x = -1, y = -1, k = 0, g = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '[')
      k++;
    else
      k--;
    g = max(g, k);
  }
  for (int i = 0; i < n; i++) {
    if (s[i] == '[') {
      x++;
      y++;
      c[x][y] = '+';
      c[x][y + 1] = '-';
      for (int j = x + 1; j < MAXN; j++) c[j][y] = '|';
    } else {
      if (s[i - 1] == '[') {
        y += 4;
      } else {
        y++;
      }
      c[x][y - 1] = '-';
      c[x][y] = '+';
      for (int j = x + 1; j < MAXN; j++) c[j][y] = '|';
      x--;
    }
  }
  y++;
  for (int i = 0; i < MAXN; i++) c[i][y] = '\0';
  for (int i = 0; i < g; i++) {
    for (int j = 0; j < y; j++) {
      cout << c[i][j];
    }
    cout << endl;
  }
  for (int i = g; i >= 0; i--) {
    for (int j = 0; j < y; j++) {
      cout << c[i][j];
    }
    cout << endl;
  }
}
