Apple interview question

String manipulation question.