We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da523f1 commit 90d65a3Copy full SHA for 90d65a3
JYP/균형잡힌 세상.py
@@ -0,0 +1,35 @@
1
+while True:
2
+ a = input()
3
+
4
+ if a == '.':
5
+ break
6
+ stk = []
7
+ ans = True
8
9
+ for g in a:
10
+ if g =='(' or g == '[':
11
+ stk.append(g)
12
+ elif g == ')':
13
+ if len(stk) == 0:
14
+ ans = False
15
16
+ if stk[-1] == '(':
17
+ stk.pop()
18
+ else:
19
+ ans=False
20
21
+ elif g ==']':
22
23
24
25
+ if stk[-1] == '[':
26
27
28
29
30
31
32
+ if ans and not stk:
33
+ print("yes")
34
35
+ print("no")
0 commit comments