문제 : https://www.acmicpc.net/problem/9012
코드
n = int(input())
for i in range(n):
stack = []
s = input()
for j in s:
if j == '(':
stack.append(j)
elif j == ')':
if stack:
stack.pop()
else:
print("NO")
break
else:
if stack:
print("NO")
else:
print("YES")
'코딩테스트 > 백준 (python)' 카테고리의 다른 글
백준 / 11047번 / 동전 0 / Greedy Algorithm / python 파이썬 (0) | 2024.09.03 |
---|---|
백준 / 7785번 / 회사에 있는 사람 / python 파이썬 (0) | 2024.09.03 |
백준 / 1439번 / 뒤집기 / python 파이썬 (0) | 2024.07.16 |
백준 / 10815번 / 숫자 카드 / python 파이썬 (0) | 2024.06.11 |
백준 / 25206번 / 너의 평점은 / python 파이썬 (1) | 2024.06.07 |