A word ladder is a sequence of words [w0, w1, ..., wn] such that each word wi in the sequence is obtained by changing a single character in the word wi-1. All words in the ladder must be valid English words.
Given two input words and a file that contains an ordered word list, implement a routine (e.g., find_shortest_ladder(word1, word2, wordlist)
) that finds the shortest ladder between the two input words. For example, for the words cold
and warm
, the routine might return:
("cold", "cord", "core", "care", "card", "ward", "warm")