with([])for(p="??()[]{}";s=readline();)for each(c in s+"\n")n=p.indexOf(c),n>0&&push(p[n^1]),putstr(n?c:pop())