import java.io.*;
import java.util.*;

public class kak_u_pakal_md implements Runnable {
    private static Scanner in;
    private static PrintWriter out;
    private String s;
    private int x;
    private char[][] ans;
    
    private char nextToken() {
        return s.charAt(x++);
    }
    
    private char curToken() {
        return (x == s.length()) ? 0 : s.charAt(x);
    }
    
    private int gcd(int a, int b) {
        while (b > 0) {
            int t = a % b;
            a = b;
            b = t;
        }
        return a;
    }
    
    private int lcm(int a, int b) {
        return a / gcd(a, b) * b;
    }
    
    private class Hieroglyph {
        boolean number, squareBraces, vertical;
        String glyph;
        ArrayList<Hieroglyph> kids = new ArrayList<Hieroglyph>();
        int minx, divx, miny, divy, n;
        
        public Hieroglyph() {
            char c = nextToken();
            if (c == '[') {
                squareBraces = true;
                c = nextToken();
            }
            if (c >= '1' && c <= '9') {
                number = true;
                glyph = "" + c;
                while (true) {
                    c = curToken();
                    if (c >= '0' && c <= '9') {
                        glyph += c;
                        nextToken();
                        continue;
                    }
                    break;
                }
            } else if (c == '(') {
                while (true) {
                    Hieroglyph h = new Hieroglyph();
                    kids.add(h);
                    c = nextToken();
                    if (c == ')')
                        break;
                    vertical = (c == ':');
                }
            }
            if (squareBraces)
                nextToken();
        }

        public void validate() {
            if (number) {
                minx = glyph.length() + 3;
                divx = 1;
                miny = 2;
                divy = 1;
                return;
            }
            minx = miny = 1;
            divx = divy = 1;
            n = kids.size();
            for (Hieroglyph h : kids) {
                h.validate();
                if (h.squareBraces)
                    n++;
                if (h.squareBraces && !vertical) {
                    minx = Math.max(minx, (h.minx + 1) / 2);
                    divx = lcm(divx, (h.divx % 2 == 0) ? h.divx / 2 : h.divx);
                } else {
                    minx = Math.max(minx, h.minx);
                    divx = lcm(divx, h.divx);
                }
                if (h.squareBraces && vertical) {
                    miny = Math.max(miny, (h.miny + 1) / 2);
                    divy = lcm(divy, (h.divy % 2 == 0) ? h.divy / 2 : h.divy);
                } else {
                    miny = Math.max(miny, h.miny);
                    divy = lcm(divy, h.divy);
                }
            }
            if (minx % divx != 0)
                minx = minx - (minx % divx) + divx;
            if (miny % divy != 0)
                miny = miny - (miny % divy) + divy;
            if (vertical) {
                miny *= n;
                divy *= n;
            } else {
                minx *= n;
                divx *= n;
            }
        }

        public void print(int x0, int y0, int X, int Y) {
            drawHorizontal(x0, y0, X);
            drawHorizontal(x0, y0 + Y, X);
            drawVertical(x0, y0, Y);
            drawVertical(x0 + X, y0, Y);
            if (number) {
                for (int i = 0; i < glyph.length(); i++) {
                    ans[y0 + 1][x0 + 2 + i] = glyph.charAt(i);
                }
                return;
            }
            int sx = X;
            int sy = Y;
            if (vertical)
                sy /= n;
            else
                sx /= n;
            for (Hieroglyph h : kids) {
                if (h.squareBraces) {
                    if (vertical) {
                        h.print(x0, y0, sx, sy * 2);
                        y0 += sy * 2;
                    } else {
                        h.print(x0, y0, sx * 2, sy);
                        x0 += sx * 2;
                    }
                } else {
                    h.print(x0, y0, sx, sy);
                    if (vertical)
                        y0 += sy;
                    else
                        x0 += sx;
                }
            }
        }
    }

    private void drawHorizontal(int x0, int y0, int x) {
        ans[y0][x0] = '+';
        ans[y0][x0 + x] = '+';
        for (int i = 1; i < x; i++)
            if (ans[y0][x0 + i] == ' ')
                ans[y0][x0 + i] = '-';
    }

    private void drawVertical(int x0, int y0, int y) {
        ans[y0][x0] = '+';
        ans[y0 + y][x0] = '+';
        for (int i = 1; i < y; i++)
            if (ans[y0 + i][x0] == ' ')
                ans[y0 + i][x0] = '|';
    }
    
    public void run() {
        try {
            solve();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    private void solve() throws IOException {
        Locale.setDefault(Locale.US);
        s = in.next();
        x = 0;
        Hieroglyph h = new Hieroglyph();
        h.validate();
        ans = new char[h.miny + 1][h.minx + 1];
        for (int i = 0; i <= h.miny; i++) {
            Arrays.fill(ans[i], ' ');
        }
        h.print(0, 0, h.minx, h.miny);
        for (int i = 0; i <= h.miny; i++) {
            out.println(new String(ans[i]));
        }
    }

    public static void main(String[] args) throws IOException {
        in = new Scanner(System.in);
        out = new PrintWriter(System.out);
        while (in.hasNext()) {
            new kak_u_pakal_md().run();
        }
        in.close();
        out.close();

    }
}
