Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Brackets by a.a.v.worker
def checkio(expression):
result = []
bracketdict = {"{":"}","[":"]","(":")"}
if len([i for i in expression if i in "{}[]()"])%2: return False
else:
for i in expression:
if i in bracketdict: result.append(bracketdict[i])
elif i in bracketdict.values() and i != result.pop(): return False
return not result
Aug. 12, 2015