Hey,
I'm trying to figure out how to re-arrange a string using every x position so that an example input string of "ABCDEFGHI" and the x being 4 would yield DHCIFEGBA. Here's how I got that:
The 1st letter is easy: it's character 4. [A, B, C, D]
The 2nd letter is also easy: it's character 8. [E, F, G, H]
The 3rd letter is mostly easy: it's character 3. This happens because I looped around as I counted, so I used I, A, B, C.
The 4th letter is where things get trickier: It's character 9. Because D and H are already gone, they don't get used in the count, resulting in E, F, G, I.
Letter #5 follows the same pattern, skipping C and D: A, B, E, F
Letter #6 has skips AND a wrap: G, A, B, E.
Letter #7 wraps again: G, A, B, G.
Letter #8 also wraps (technically twice since 'cursor' was behind G before: A, B, A, B
Letter #9 is our remainder: A, A, A, A
It's clearly going to need to loop until output string length matches input string length - it's all of this mess in the middle (Mostly the skips and loops) that I can't for the life of me figure out.
Any help or guidance is appreciated.