Western Union Interview Question

string sorting problem