Files
CodeTest/baekjoon/괄호/solution_6775336.py
2024-08-29 16:23:53 +09:00

14 lines
279 B
Python

for _ in range(int(input())) :
op,cl,ret = 0,0,'YES'
for c in input() :
if c=='(' :
op+=1
else :
cl+=1
if op<cl :
ret = 'NO'
break
if op-cl!=0 :
ret = 'NO'
print(ret)