import sys
input = sys.stdin.readline

while True:
    sentence = input().strip('\n')
    if sentence == '.':
        break
    snt_list = []
    result = []
    print_sth = ''
    for i in sentence:
        if (ord(i) < 65) or (90 < ord(i) < 97) or (ord(i) > 122) or (i != ' '):
            snt_list.append(i)
    for j in snt_list:
        if j == '(' or j == '[':
            result.append(j)
        elif j == ')':
            if len(result) != 0 and result[-1] == '(':
                result.pop()
            else:
                if print_sth == '':
                    print_sth += 'no'
        elif j == ']':
            if result[-1] == '[':
                result.pop()
            else:
                if print_sth == '':
                    print_sth += 'no'
    if len(result) == 0:
        if print_sth == '':
            print_sth += 'yes'
    print(print_sth)