s = input() def getresult(s): stack = [] for c in s: if c=='(' or c=='[' or c=='{':#正括号入栈 stack.append(c) elif c==')':#小括号配对 if len(stack)>0 and stack[-1]=='(': stack.pop() else: return 'false' elif c==']':#中括号配对 if len(stack)>0 and stack[-1]=='[': stack.pop() else: return 'false' elif c=='}':#大括号配对 if len(stack)>0 and stack[-1]=='{': stack.pop() else: return 'false' return 'true' if len(stack)==0 else 'false'#查看所有括号是否配对完成 print(getresult(s))