728x90
SMALL
t = int(input())
answer = []
for _ in range(t):
ps = list(input())
while len(ps)!=0:
if ps[0] ==')':
answer.append('NO')
break
else:
if ')' in ps:
ps.remove(')')
ps.remove('(')
else:
answer.append('NO')
break
if len(ps)==0:
answer.append('YES')
for i in answer:
print(i)
728x90
LIST
'취준시절 > 백준' 카테고리의 다른 글
[백준 1158] 요세푸스 문제 - Python (0) | 2021.07.31 |
---|---|
[백준 1966] 프린터 큐- Python (0) | 2021.07.31 |
[백준 1874] 스택 수열 - Python (0) | 2021.07.09 |
[백준 10773] 제로 - Ptyhon (0) | 2021.07.09 |
[백준 10828] 스택 - Python (0) | 2021.07.05 |