Wipro interview question

String coding question