Microsoft interview question

String manipulation Q