Time for binary sort or an elimination chart; take every character, compare them to another, sort them as to which one you prefer. Then assign a number to each one of them.
Preferences don't tend to work that way. You know how, if you use a sort function that accepts a user-defined comparator, the documentation will have dire warnings about making sure that the comparator gives consistent results?
The procedure you're suggesting here doesn't comply with those warnings. Sorting will not terminate, or will yield different results from attempt to attempt.