while 1:p=raw_input();s=y=0;exec'y+=1;Y=""\nfor x in p:s+=x<")";Y+=[" ",x][y==s];s-=x>"(";Z=Y.rstrip()\nif Z:print Z;'*8