IBM interview question

It was Coding round, String manipulation.