#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int n;
  cin >> n >> str;
  int A[n], m = 0;
  string RE[n];
  A[0] = 0;
  for (int i = 1, t = 0, tmp = '['; i < n; i++) {
    if (str[i] == tmp) {
      if (str[i] == ']')
        t--;
      else
        t++;
    }
    A[i] = t;
    if (t > m) m = t;
    tmp = str[i];
  }
  for (int i = 0; i < m + 2; i++) {
    for (int j = 0; j < n; j++) {
      if (A[j] == i) {
        if (str[j] == '[')
          RE[i].append("+-");
        else if (str[j] == ']' && str[j - 1] == '[')
          RE[i].append(" -+");
        else
          RE[i].append("-+");
      } else if (A[j] > i) {
        if (str[j - 1] == str[j])
          RE[i].append(" ");
        else if (str[j - 1] == '[' && str[j] == ']')
          RE[i].append("  ");
        else
          RE[i].append("   ");
      } else {
        if (str[j - 1] == '[' && str[j] == ']') {
          RE[i].append("   |");
        } else {
          RE[i].append("|");
        }
      }
    }
    cout << RE[i] << endl;
  }
  for (int i = m; i >= 0; i--) {
    cout << RE[i] << endl;
  }
}
