← 返回 amazon 的题目列表Shortest Word Transformation Sequence Length Using Dictionary
类型:online_judge
amazon
Given an undirected graph where each node represents a word, find the shortest transformation sequence from a given start word to a target word. At each change, only one letter can be altered, and the resulting word must exist in the dictionary. The program receives input and output through standard input and prints the minimum length of the transformation sequence. Return 0 if no such sequence exists.
Example
Input
hit
cog
hot dot dog lot log cog