b=raw_input() m=[0]*6 p=x=0 _='' while x<len(b):exec'_+=chr(m[p]) m[p]+=1 x=b.rfind("[",0,x)-1 p-=1 x=(x,b.find("]",x))[m[p]<1] p+=1 m[p]-=1'.split()[hash(b[x])%39%7];x+=1 print _
Note that non-ascii characters in the above source code will be escaped (such as \x9f).