Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Really short solution in Uncategorized category for Brackets by panki
# migrated from python 2.7
import re
def checkio(Expression):
s = re.sub('[^(){}\[\]]+', '', Expression)
n = len(s)
while n:
s, n = re.subn('\(\)|\[\]|\{\}', '', s)
return not bool(s)
if __name__ == '__main__':
assert checkio('({(asda)sd[s]d})') == True, 'First'
assert checkio('({[a]((s)})') == False, 'Second'
print('All ok')
March 25, 2012
Comments: