sdroW tsegnoL

After yesterday's bit of fun with Python and the English dictionary, the thought suddenly popped into my head:

There are eight six letter words in English whose letters are in alphabetical order. But what about reverse alphabetical order?

Luckily, the change was a simple one. If you pass --reverse to the longest-words.py script, it simply reverses the alphabet you're comparing against:

if "--reverse" in sys.argv:
    # Reverse the LETTERS list so that 'z' is at the start of the
    # alphabet and so on.
    LETTERS = LETTERS[::-1]

(It's a bit rudimentary but it does the job, and we don't care about the fact that we're mutating the global variable LETTERS since the whole script is short-lived).

Turns out that when you reverse the alphabet you actually get only two words with ordered letters, both 7 seven letters long:

$ python longest-word.py --reverse
sponged (7), wronged (7)

John Meinel wondered in a comment whether German would give us significantly longer words. Expect an update on this later...

Code is on github of course.