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

public class kak_u_pakal_gk {
    static Scanner in;
    static PrintWriter out;

    StringTokenizer t;
    String token;
    char[][] rows;

    static int gcd(int a, int b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }

    static int lcm(int a, int b) {
        return a / gcd(a, b) * b;
    }

    static class Dimension {
        final int size;
        final int extent;

        Dimension(int size, int extent) {
            this.size = size;
            this.extent = extent;
        }

        Dimension unify(Dimension that) {
            int size1 = this.size;
            int size2 = that.size;
            while (size1 != size2) {
                if (size1 < size2) {
                    size1 += this.extent;
                } else {
                    size2 += that.extent;
                }
            }
            return new Dimension(size1, lcm(this.extent, that.extent));
        }

        Dimension dbl() {
            Dimension d = unify(new Dimension(0, 2));
            return new Dimension(d.size / 2, d.extent / 2);
        }
    }

    abstract class Glyph {
        Dimension w;
        Dimension h;
        int psize = 1;

        abstract void write(int x, int y, int w, int h);
        void setDirection(boolean horz) {}
    }

    class Double extends Glyph {
        final Glyph glyph;
        boolean horz;

        Double(Glyph glyph) {
            this.glyph = glyph;
            psize = 2;
            w = glyph.w;
            h = glyph.h;
        }

        @Override
        void setDirection(boolean horz) {
            this.horz = horz;
            if (horz) {
                w = w.dbl();
            } else {
                h = h.dbl();
            }
        }

        void write(int x, int y, int w, int h) {
            if (horz) w *= 2; else h *= 2;
            glyph.write(x, y, w, h);
        }
    }

    class Comp extends Glyph {
        int size;

        final List<Glyph> glyphs;
        final boolean horz;

        Comp(boolean horz, List<Glyph> glyphs) {
            this.glyphs = glyphs;
            this.horz = horz;

            size = 0;
            w = new Dimension(0, 1);
            h = new Dimension(0, 1);
            for (Glyph g : glyphs) {
                g.setDirection(horz);
                size += g.psize;
                h = h.unify(g.h);
                w = w.unify(g.w);
            }
            if (horz) {
                w = new Dimension(size * w.size, size * w.extent);
            } else {
                h = new Dimension(size * h.size, size * h.extent);
            }
        }

        void write(int x, int y, int w, int h) {
            if (horz) w /= size; else h /= size;
            int dx =  horz ? w : 0;
            int dy = !horz ? h : 0;
            for (Glyph g : glyphs) {
                g.write(x, y, w, h);
                x += dx * g.psize;
                y += dy * g.psize;
            }
        }
    }

    class Leaf extends Glyph {
        final String id;

        Leaf(String id) {
            this.id = id;
            w = new Dimension(id.length() + 3, 1);
            h = new Dimension(2, 1);
        }

        void write(int x, int y, int w, int h) {
            drawBox(x, y, w, h);
            for (int i = 0; i < id.length(); i++) {
                set(x + 2 + i, y + 1, id.charAt(i));
            }
        }
    }

    void nextToken() {
        token = t.nextToken();
    }

    boolean test(String s) {
        if (s.equals(token)) {
            nextToken();
            return true;
        }
        return false;
    }

    void expect(String s) {
        if (!test(s)) {
            throw new RuntimeException(s + " expected instead of " + token);
        }
    }

    Glyph parseBlock() {
        Glyph g;
        if (test("[")) {
            g = new Double(parseBlock());
            expect("]");
        } else if (test("(")) {
            List<Glyph> glyphs = new ArrayList<Glyph>();
            glyphs.add(parseBlock());
            String op = token;
            while (test(op)) {
                glyphs.add(parseBlock());
            }
            g = new Comp(".".equals(op), glyphs);
            expect(")");
        } else {
            g = new Leaf(token);
            nextToken();
        }
        return g;
    }

    void set(int x, int y, char ch) {
        rows[y][x] = rows[y][x] == ' ' || rows[y][x] == ch ? ch : '+';
    }

    void drawHorz(int x, int y, int l) {
        for (int i = 0; i <= l; i++) set(x + i, y, '-');
    }
    void drawVert(int x, int y, int l) {
        for (int i = 0; i <= l; i++) set(x, y + i, '|');
    }

    void drawBox(int x, int y, int w, int h) {
        drawVert(x, y, h);
        drawHorz(x, y, w);
        drawVert(x + w, y, h);
        drawHorz(x, y + h, w);
    }

    public void run() throws IOException {
        t = new StringTokenizer(in.nextLine() + "!!", "():.[]!", true);

        nextToken();
        Glyph root = parseBlock();
        expect("!");

        rows = new char[root.h.size + 1][root.w.size + 1];
        for (char[] row : rows) {
            Arrays.fill(row, ' ');
        }
        root.write(0, 0, root.w.size, root.h.size);

        for (char[] row : rows) {
            out.println(row);
        }
    }

    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_gk().run();
        }
        out.close();
    }
}
