IBM Interview Question

It was Coding round, String manipulation.