[python] 백준 9012번 DataStructure

김보현·2024년 6월 17일
0

PS

목록 보기
38/62

풀이

정답

t = int(input())
for i in range(t):
    total = []
    x = input()
    for j in x:
        if j == '(':
            total.append(j)
        elif j == ')':
            if total:
                total.pop()
            else:
                print("NO")
                break
    else:
        if len(total) == 0:
            print("YES")
        else:
            print("NO")
profile
Fall in love with Computer Vision

0개의 댓글

관련 채용 정보