code = "([{}])"
stack = []
open = {')': '(', ']': '[', '}': '{'}
is_valid = 0
for ch in code:
if ch in '([{':
stack.append(ch)
elif ch in ')]}':
if not stack:
is_valid = 1
break
if stack.pop() != open[ch]:
is_valid = 1
break
if is_valid == 1:
print("False")
else:
print("True")
To embed this project on your website, copy the following code and paste it into your website's HTML: