#include<iostream>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
int total = 0;
string s;
void print(int a)
{
cout << '+';
for (int i = 0; i < a; i++)
cout << '-';
cout << '+';
}
int main()
{
cin >> s;
int max_ = 0;
for (int i = 0; i < s.size(); i++)
{
if (s[i] == '[')
total += 1;
else
total -= 1;
max_ = max(max_, total);
}
total = max_;
for (int i = 0; i < s.size(); i++)
{
if (s[i] == '[')
{
for (int j = max_ - total - 1; j>0; j--)
cout << ' ';
if (total != max_)
cout << '|';
print(2 * total - 1);
if (total != max_)
cout << '|';
total--;
}
else
{
total++;
if (s[i - 1] == '[')
{
for (int k = 0; k < 2; k++)
{
for (int j = 0; j < max_ - total; j++)
cout << ' ';
cout << '|';
for (int j = 0; j < 2 * total - 1; j++)
cout << ' ';
cout << '|' << endl;
if (k == 0)
cout << endl;
}
}
for (int j = max_ - total - 1; j>0; j--)
cout << ' ';
if (total != max_)
cout << '|';
print(2 * total - 1);
if (total != max_)
cout << '|';
}
if (i != s.size() - 1)
cout << endl;
}
return 0;
}