문제 링크 https://www.acmicpc.net/problem/4949
문제를 꼼꼼히 읽어야한다.
내가 놓친 부분이 '.' 온점에 관한 처리를 놓쳤다.
input
[.
.
결과
no
import sys, re
a = ''
while True:
a += sys.stdin.readline().rstrip()
if a == '.':
break
elif a[-1] != '.':
continue
n = re.sub(r'([a-z,A-Z," "])', '', a)
result = list()
for i in n:
if i in ('[', '('):
result.append(i)
elif i in (']', ')'):
if result:
if i == ']' and result[-1] == '[':
result.pop()
elif i == ')' and result[-1] == '(':
result.pop()
elif i == ']' and result[-1] == '(':
result.append(i)
break
elif i == ')' and result[-1] == '[':
result.append(i)
break
else:
result.append(i)
break
if result:
print('no')
else:
print('yes')
a = ''