Code for problem "Valid Parentheses".