entries are sorted by that language's rules. Words compare as usual: at the first position where they differ, and if one word is the beginning of another, the shorter one comes first.
Return a string with every letter that appears in the dictionary, each once, in the order of that language's alphabet. If no letter order could make the dictionary sorted, return the empty string "".
It is guaranteed that whenever a suitable order exists, it is the only one.entries=['kot', 'kit', 'ti', 'tk'] → 'oikt'
Neighbouring pairs give: kot before kit means o comes before i, kit before ti means k before t, ti before tk means i before k. Together that leaves the single order o, i, k, t.
entries=['ba', 'ab', 'ba'] → ''
The first pair needs b before a, the second needs a before b. No alphabet can do both.
entries=['moon', 'mo'] → ''
mo is the beginning of moon, so under any letter order it has to come first.
entries=['kot', 'kit', 'ti', 'tk']
'oikt'
Run checks the first 3 tests in your browser. Submit checks all 93 tests on the server, hidden ones included.