Need help with string variable formatting

Reverse loop: last to first

Normal loop: first to last.