"This is my step ladder. I never knew my real ladder."  Louis C.K.
Let's assume for a minute that your favorite thing in the world is a dictionary full of, well, words. Your secondfavorite thing is to invent games involving said dictionary, although nobody ever wants to play them with you because they involve said dictionary. Anyway, here's your most recent addition to the world of gaming!
An edit step is a transformation from one word \(x\) to another word \(y\) such that \(x\) and \(y\) are words in the dictionary, and \(x\) can be transformed to \(y\) by adding, deleting, or changing one letter. The transformations from dig
to dog
and from dog
to do
are both edit steps. An edit step ladder is a lexicographically ordered sequence of words \(w_1, \ldots, w_n\) such that the transformation from \(w_i\) to \(w_{i+1}\) is an edit step for all \(1 \leq i < n\).
For a given dictionary, you are to compute the length of the longest edit step ladder.
The input to your program consists of the dictionary: a set of lowercase words in lexicographic order at one word per line. No word exceeds 16 letters and there are at most 25,000 words in the dictionary.
The output consists of a single integer, the number of words in the longest edit step ladder.
cat
dig
dog
fig
fin
fine
fog
log
wine
5
This is challenge 10029 of the ACM International Collegiate Programming Contest. Test input is provided by uDebug.
Please log in to submit your solution.
Difficulty 

Average test runtime  0.27 
Points (changes over time)  10 
Tried by  8 users 
Solved by  7 users 
#  Name  Runtime  Points worth 

1  ,s/java/NaN/gi  0.15  16 
2  贝尔恩德  0.21  12 
3  JB  0.24  10 
4  Mac  0.26  9 
5  Dark  0.27  9 
6  Ali  0.33  7 
7  Skøgland  0.40  6 