Python
import re def areCurlyBracesMatched(s): if len(re.findall('[^{}]',s)) > 0 : return False while True: start = s.find('{') end = s.find('}') if start < end and (start >=0 and end >= 0): s=s.replace('{','',1) s=s.replace('}','',1) else: break if len(s) == 0: return True else: return False
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Python