Problem A
Doublets
Languages
en
es
fr
pt
A Doublet is a pair of words that differ in exactly one letter; for example, “booster” and “rooster” or “rooster” and “roaster” or “roaster” and “roasted”.
You are given a dictionary of up to
Input
Input consists of the dictionary (with at most
Output
For each input pair, print a set of lines starting with the first word and ending with the last. Each pair of adjacent lines must be a doublet. If there are several minimal solutions, any one will do. If there is no solution, print a line: “No solution.” Leave a blank line between cases.
Sample Input 1 | Sample Output 1 |
---|---|
booster rooster roaster coasted roasted coastal postal booster roasted coastal postal |
booster rooster roaster roasted No solution. |