Microsoft interview question

String sorting and reordering.