s=input() als=[s[0]] hefa={'(':')','[':']','{':'}','"':'"',"'":"'"} for i in s[1:]: if (als[-1],i) in hefa.items(): als.pop() else: als.append(i) print('true') if len(als)==0 else print('false')
s=input() als=[s[0]] hefa={'(':')','[':']','{':'}','"':'"',"'":"'"} for i in s[1:]: if (als[-1],i) in hefa.items(): als.pop() else: als.append(i) print('true') if len(als)==0 else print('false')