check a string for balanced parenthesis