OlveraeUNSW
返回题目列表
COMP2041

22T2 Q11 — onesie 词梯(BFS)

参数:词表文件名、起始词、目标词。两词相连当且仅当等长且恰好一个位置不同。打印从起点到目标(含)的最短链,每行一个词,只用词表中的词;不可达则打印 No solution。(并列最短时:BFS 按排序后的候选词扫描。)


Python only. From COMP2041/9044 22T2 Final.

样例

stdin
期望输出
cat
cot
cog
dog
python3
14