俗话说,只因少了一枚马蹄钉,一个王国便就此覆灭。
给定一组输入,生成相应的谚语。
例如,给定列表["nail", "shoe", "horse", "rider", "message", "battle", "kingdom"],你需要输出这首谚语诗谣的完整内容:
For want of a nail the shoe was lost.
For want of a shoe the horse was lost.
For want of a horse the rider was lost.
For want of a rider the message was lost.
For want of a message the battle was lost.
For want of a battle the kingdom was lost.
And all for the want of a nail.
注意,输入的列表可能各不相同;你的解答应能处理任意长度和任意内容的列表。 输出文本的每一行都不应是固定不变的字符串,而应随给定的输入而变化。
每个输入列表都用一个字符串表示,每个输入的末尾都有一个换行符。
例如"nail\nshoe\nhorse\nrider\nmessage\nbattle\nkingdom\n"
每一行输出都应以换行符\n结尾。
线性内存的第 128 到 383 字节预留给输入字符串。