main=interact$foldl(&)"" (x:s)&'?'=s&x s&x=[z|(y,z)<-zip"([{"")]}",y==x]++s++[x]