added solution for balanced-brackets