#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cassert>
using namespace std;

#define MAXL 2100
#define MAXS 1050

char buf[MAXL];
char out[MAXS][MAXS];

struct Bnode{
        Bnode *l, *r;
        Bnode(){ l = r = NULL; }
        ~Bnode(){ delete l; delete r; }
};

char *ptr;

void parse(Bnode *x){
        assert(*ptr == '(');

        ++ptr;
        if(*ptr == ')'){
                ++ptr;
                return;
        }

        assert(*ptr == '(');
        x->l = new Bnode;
        parse(x->l);

        if(*ptr == ')'){
                ++ptr;
                return;
        }

        assert(*ptr == '(');
        x->r = new Bnode;
        parse(x->r);

        assert(*ptr == ')');
        ++ptr;
}

void compress(Bnode *x){
        if(x == NULL)
                return;
        putchar('(');
        compress(x->l);
        compress(x->r);
        putchar(')');
}

void line(int r, int c1, int c2){
        for (int i=c1; i<=c2; ++i)
                out[r][i] = (i - c1) % 2 ? '-' : '+';
}

int W, D;

int draw(Bnode *x, int d, char c){
        D = max(D, d);

        if(x->l == NULL){
                out[d][W] = c;
                W += 2;
                return W - 2;
        }

        int wl = draw(x->l, d + 2, 'L');
        out[d + 1][wl] = '|';

        if(x->r == NULL){
                out[d][wl] = c;
                return wl;
        }

        int wr = draw(x->r, d + 2, 'R');
        out[d + 1][wr] = '|';
        line(d, wl, wr);
        out[d][2 * ((wl + wr) / 4)] = c;
        return 2 * ((wl + wr) / 4);
}

int main(){
        fgets(buf, MAXL, stdin);
        Bnode *root = new Bnode;
        ptr = buf;

        parse(root);

        memset(out,'.',sizeof(out));

        W = D = 0;
        draw(root, 0, 'H');

        printf("%d %d\n", D / 2 + 1, W / 2);
        for (int i=0; i<=D; ++i) {
                for (int j=0; j<W; ++j)
                        putchar(out[i][j]);
                putchar('\n');
        }

        delete root;
}
