Make a program that takes the word you input, and adds that word to the back of itself minus its first letter, then repeats until all letters are gone. For example, cat
would become catatt
, and hello
would become helloellolloloo
.
Input
Any of the 26 letters of the English alphabet. There may be multiple words separated by spaces, and the change should be applied to every word.
Output
The word(s) inputted, with each word put after itself with its first letter missing, and then with its second letter missing, and so on until there are no more letters to add.
More examples:
ill eel
outputs illlll eelell
laser bat
outputs laserasersererr batatt
darth vader
outputs dartharthrththh vaderaderdererr
This is code golf, so the shortest code wins.
Clarification:
You can treat the input or output as a list. You can separate words using newline instead of space. You can add a trailing space to the input.
1.
Please update the spec with the new allowances (array I/O, trailing space, etc.)2.
Please inform the existing solutions in case any can save bytes by taking advantage of them. \$\endgroup\$