Solution for Valid Parentheses.