Skip to content

Commit da523f1

Browse files
committed
[BOJ] 괄호 / 실버4 / 12분
1 parent 5d46152 commit da523f1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

JYP/괄호.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
a = int(input())
2+
3+
for i in range(a):
4+
res = []
5+
b = str(input())
6+
for c in b:
7+
if c == '(':
8+
res.append(c)
9+
elif c == ')':
10+
if res:
11+
res.pop()
12+
else:
13+
print("NO")
14+
break
15+
else:
16+
if len(res) == 0:
17+
print("YES")
18+
else:
19+
print("NO")

0 commit comments

Comments
 (0)