백준 괄호 파이썬 (1) 썸네일형 리스트형 [백준] 괄호 9012 Python 1 2 3 4 5 6 7 8 9 N = int(input()) for i in range(N): temp = input() while "()" in temp: temp = temp.replace("()", "") if len(temp) > 0: print("NO") else: print("YES") Stack으로 풀 수 있지만 replace를 이용하여 제거 해나가는 식으로 가능함. 이전 1 다음