# your code goes here
while True:
    Testcase = input()
    stack = []
    if Testcase == '.':
        break
    for i in Testcase:
        if i == '(':
            stack.append('(')
        elif i == ')':
            if len(stack) == 0:
                stack.append('error')
                break
            stack.append(')')
            for j in stack:
                if j != '(':
                    continue
                else:
                    stack.pop()
                    if stack.pop() == '[':
                        stack.append("error")
                    break
        elif i == '[':
            stack.append('[')
        elif i == ']':
            if len(stack) == 0:
                stack.append('error')
                break
            stack.append(']')
            for j in stack:
                if j != '[':
                    continue
                else:
                    stack.pop()
                    if stack.pop() == '(':
                        stack.append("error")
                    break
                    
    if len(stack) == 0:
        print('yes')
    else:
        print('no')