#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int n, m = -1, step[105];
char a[105];
void printRow(int i) {
  for (int j = 0; j < n; j++) {
    if (step[j] == i) {
      if (a[j] == '[')
        printf("+-");
      else {
        if (j - 1 >= 0 && a[j - 1] == '[') printf(" ");
        printf("-+");
      }
    } else if (step[j] < i) {
      printf("|");
      if (j + 1 < n && a[j] == '[' && a[j + 1] == ']') printf("   ");
    } else {
      printf(" ");
      if (j - 1 >= 0 && a[j] == '[' && a[j - 1] == ']') printf(" ");
      if (j - 1 >= 0 && a[j] == ']' && a[j - 1] == '[') printf(" ");
      if (j + 1 < n && a[j] == ']' && a[j + 1] == '[') printf(" ");
    }
  }
  printf("\n");
}
int main() {
  scanf("%d%s", &n, a);
  for (int i = 0; i < n; i++) {
    if (a[i] == '[') {
      step[i] = v.size() + 1;
      v.push_back(i);
      if (step[i] > m) m = step[i];
    } else {
      step[i] = step[v.back()];
      v.pop_back();
    }
  }
  for (int i = 1; i <= m + 1; i++) printRow(i);
  for (int i = m; i > 0; i--) printRow(i);
  return 0;
}
