solve balance parenthesis