728x90
[나의 풀이]
len_element = int(input())
right_num = 0
left_num = 0
for i in range(len_element):
box = input()
for s in box:
if s == '(':
right_num += 1
else :
left_num += 1
if right_num == left_num:
while box.find('()') != -1:
box = box.replace('()', '')
if box == '':
print('YES')
else:
print('NO')
else:
print('NO')
right_num = 0
left_num = 0
728x90
'STUDY > Python' 카테고리의 다른 글
[Softeer] 바이러스 python (0) | 2023.06.25 |
---|---|
[백준] 18258번 큐2 python (0) | 2023.06.20 |
[백준] 10828번 스택 python (0) | 2023.06.19 |
[자료구조] 스택 stack (0) | 2023.06.19 |
[프로그래머스] 문자열의 뒤의 n글자 (0) | 2023.06.12 |