Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check2(s):
- stack3 = []
- pod_mat = {')': '(', '}': '{', ']': '['}
- for i in s:
- if i in pod_mat.values():
- stack3.append(i)
- elif i in pod_mat:
- if not stack3 or stack3.pop() != pod_mat[i]:
- return False
- else:
- return False
- return not stack3
- s = input()
- if (check2(s)) == True:
- print("yes")
- else:
- print("no")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement