Western Union interview question

string sorting problem