Proverbio

Proverbio

Facile

Istruzioni

Per la mancanza di un chiodo da ferro di cavallo andò perduto un regno, o almeno così dice il detto.

Dato un array di input, genera il proverbio corrispondente. Per esempio, dato l'array ["nail", "shoe", "horse", "rider", "message", "battle", "kingdom"], l'output sarà il testo completo di questa filastrocca proverbiale:

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.

Nota che l'array di input può variare: la soluzione deve essere in grado di gestire array di lunghezza e contenuto arbitrari. Nessuna riga del testo di output deve essere una stringa statica e immutabile, tutte devono variare in base all'input fornito.


Fonte

WikipediaIl link si apre in una nuova finestra o scheda
Modifica tramite GitHub Il link si apre in una nuova finestra o scheda
Delphi Pascal Exercism

Vuoi iniziare Proverbio?

Iscriviti a Exercism per imparare e padroneggiare Delphi Pascal con 76 esercizi e il mentoring di persone reali, tutto gratis.