Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Brackets by tarasenkoa
def checkio(expression):
d = {
"}": "{",
"]": "[",
")": "(",
}
a = []
for c in expression:
if c in "{([":
a.append(c)
if c in d and (len(a) == 0 or a.pop() != d[c]):
return False
return len(a) == 0
Feb. 26, 2015