Nagarro Interview Question

Decode string and find number of pairs