Red Hat interview question

Validate parentheses sequence with multiple types