first commit

from old repository to a new repository
This commit is contained in:
Gyubin Han
2024-04-30 16:59:10 +09:00
commit 2600340c03
93 changed files with 1610 additions and 0 deletions

37
boj/4949.py Normal file
View File

@@ -0,0 +1,37 @@
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")