We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8d5796c commit 67e48afCopy full SHA for 67e48af
1 file changed
김지호/7주차/260211.py
@@ -0,0 +1,27 @@
1
+
2
+while True :
3
+ a = input()
4
+ stack = []
5
6
+ if a == "." :
7
+ break
8
9
+ for i in a :
10
+ if i == '[' or i == '(' :
11
+ stack.append(i)
12
+ elif i == ']' :
13
+ if len(stack) != 0 and stack[-1] == '[' :
14
+ stack.pop() # 맞으면 지워서 stack을 비워줌 0 = yes
15
+ else :
16
+ stack.append(']')
17
18
+ elif i == ')' :
19
+ if len(stack) != 0 and stack[-1] == '(' :
20
+ stack.pop()
21
22
+ stack.append(')')
23
24
+ if len(stack) == 0 :
25
+ print('yes')
26
27
+ print('no')
0 commit comments