Apple interview question

String manipulation and sorting algorithm