Fidessa interview question

Matching pairs in string