problem VALID-PARENTHESES solved with the help of a stack