For all of the following words, if you move the first letter to the end of the word, and then spell the result backwards, you will get the original word: banana dresser grammar potato revive uneven assess
I got the first part down, moving the first letter to the end, but I am not able to spell the word in reverse. I have to use a for
loop for this, but I have no idea how to use it so it will spell the rest of the word backwards.
Normally the for-loop does not care in which way you modify the index, so you should be able to use something like
string firstAtLast = "otatop";
string reverse = "";
for(int i=string.length-1; i => 0; i--)
{
reverse += firstAtLast.At(i)
}
Details for i and the string manipulation methods depend on your language of course.