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