Chargebee interview question

Coding Interview Question based on String