Chargebee interview question

String manipulation like count repeated char in string