A Man, A Plan, A Canal, A Librarian!

Saturday, June 26th, 2004

Can't come up with a better palindrome than "a man, a plan, a canal, Panama!"? Write a program and come up with one that's 17,000+ words. I love computers and what people do with them.

The most extreme thing I ever did along these lines is when my airplane was circling an airport for some unknown reason and the United flight attendant announced a contest to keep our minds off the dwindling fuel and the terrorists on the ground (oh, wait, that's Die Hard...). Anyway, she offered a free bag of peanuts (or something of equal value) to the person that could come up with the most words of 3 or more letters from the letters in the word "united" (Always Be Closing...).

Did I put my Tim Ewald-expanded vocabulary to work? Did I scratch words onto a cocktail napkin as fast as I could think of them?

No. In the limited time I had, I wrote a program that would come up with random combinations of letters in brute force fashion, then dumped the unique ones to a file so that I could use Word's spell checker to find the real words. I came up with 32. Did I win?

No. A librarian, using her own expanded vocabulary beat me with 34 (I had been running the program to generate 1000 possibilities to speed testing but forgot to flip it back to 10,000 when it came time to run it for real).

Did I stop there? Did I accept defeat gracefully, especially since it's pretty clear I had cheated in the first place?

No. I went home and learned the STL permutation algorithm and wrote a program that compared against a dictionary from the web to find the 72 words of 3 or more letters in "united" (including asynchronous updates to the UI as possibilities are checked [it takes a little longer, but it's worth it...]).

Now I carry that program on my laptop wherever I go, just in case I run into that damn librarian again...

P.S. I did get to use my program one more time against my mother playing Scrabble. I got my all-time high Scrabble score ever on that day. She still beat me. Did I mention she's got a bachelor's degree in library science? Damn librarians...

Discuss