import sys
s=input()
stack=[]
dic={")":"(","]":"["}
k=[]
def fun(s):
    for i in s:
        if i=="(" or i=="[":
            stack.append(i)
        elif i==")" or i=="]":
            if not stack or stack[-1]!=dic[i]:
                k.append(1)
            else:
                stack.pop()
fun(s)
if len(k)==0:
    print("true")
else:
    print("false")