I have multiple choice menus in my program like so:
Which option do you want? (choose one)
f: First option
s: Second option
t: Third option
The user then presses f
, s
or t
to make their choice. For this example, I picked the letters manually, and it should be obvious how.
But in some cases there are conflicts: Suppose I had a Fourth option
- I can't use f
. Sensible choices include F
, h
and others, depending on UX philosophy.
Is there an algorithm that will, given a list of strings, generate a unique mnemonic letter to identify each string? By "mnemonic", I mean that the option should suggest the letter (as in my example), so that it is easy to remember which is which (as opposed to just mapping everything to a, b, c or x, y, z).
As I noted above, there are multiple ways of doing this, depending on what you prefer: Capitalized letters, letters within the first word, letters of secondary unique words, etc. For this question, I don't really care about these, so feel free to use your own rules - so long as the algorithm produces reasonably user-friendly results.