|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||8||2||2||100.000%|
Farmer John is playing a word game against his cows. It starts like this:
Farmer John then must morph his word to the cows' word by performing a number of steps, each one of which changes one single letter at a time to make a new, valid word.
Farmer John can only use the words in the following file dict.txt.
For this example, Farmer John could make the following sequence of four words:
'cat' -> 'cot' -> 'cog' -> 'dog'
to morph words from the first word 'cat' to the final word 'dog' in just three moves. The cows will never give Farmer John an impossible task. Farmer John must get from his word to the cows' word in as few moves as possible.
You will be given a starting word and an ending word. Determine and output a number which is the least number of legal letter changes required to morph the starting word to the ending word.