Capgemini Engineering interview question

OOP, Code related to strings operations