Files
PS/boj/4949.py
Gyubin Han 2600340c03 first commit
from old repository to a new repository
2024-04-30 16:59:10 +09:00

37 lines
746 B
Python

from sys import stdin
while True:
s=stdin.readline().rstrip()
st=[]
if s=='.':
break
suc=True
for i in range(len(s)):
c=s[i]
if c=='(' or c=='{' or c=='[':
st.append(c)
elif c==')' or c=='}' or c==']':
if len(st)==0:
suc=False
break
p=st.pop()
if c==')' and not p=='(':
suc=False
break
elif c=='}' and not p=='{':
suc=False
break
elif c==']' and not p=='[':
suc=False
break
if len(st)>0:
suc=False
if suc:
print("yes")
else:
print("no")