Word Ladders Mini Challenge
Completed Oct. 29, 2010
There are nearly 6000 five-letter words in the English language. For two given words in the dictionary, we can transform one into the other using a word ladder, where a single letter is changed at a time and all intervening steps are also valid english words.
For instance, we can transform "scale" into "cloud" in 14 steps:
scale scare share shard chard chart chert cheat cleat bleat bloat float flout clout cloud 14
Given any two valid five-letter words, generate a shortest possible word ladder between them. Your program should produce output similar to the example above. Each step in the ladder, including the source and target words, should be printed on a single line, followed by the number steps required to reach the goal. If there is no possible path, you should output the source word on the first line, and 0 on the second.
Given any single valid five-letter word as a starting point, find the word in the dictionary that represents the end-point of the longest word ladder that you can build without visiting the same word twice. Your program should produce the same type of output as the first problem.
Please download the following word file to use as your dictionary.
Thanks to Chronicler for the submission!