while 1: s={};i=l=0 for c in raw_input():i-=c>"(";s[i]=s.get(i,"").ljust(l)+c;i+=c<")";l+=1 for _ in s:print s[_]