俗話說,少了一根馬蹄釘,就失去了一個王國。
給定一個輸入陣列,產生對應的諺語。
例如,給定["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.
注意,輸入的陣列可能不同;你的解法應該要能處理任意長度與內容的陣列。 輸出的文字中,不該有任何一行是固定不變的字串;每一行都應該隨著給定的輸入而變化。