def f(L,D=0,S='',d=0): for c in L:C=c>'(';S+=[' ',c][d-C==D];d-=C*2-1 if'('in S:print S.rstrip();f(L,D+1) f(raw_input()) f('')