SolarWinds interview question

Find valid parenthesis pairs in a string with alphabets and brackets.