for(a=[];r=readline();)for each(c in r+"\n")putstr(c!='?'?c:a.pop())|((f="()([][{}".split(c)[1])&&a.push(f))