String Swaps

You are given a string of N characters(1-indexed), and an integer D. Now you select the substring S[1]…S[D] and swap the letters in the following manner:
S[1],S[2]…S[D-1]S[D] => S[D]S[D-1]S[D-2]…S[2]S[1]
Next you select the substring S[2]…S[D+1] and do the same. You do this operation likewise N-D+1 times, shifting the substring by 1 position to the right for every consecutive operation. (selecting substring S[N-D+1]…S[N] in the last step.
Find the string at the end. O(NlogN)

I am not sure if this is a very standard problem or not. Opinions welcomed.

My Solution :

Isn’t the final string directly, S’ = S[D],S[D+1],…S[N],(S[D-1],S[D-2]…,S[1]) or S’ = S[D],S[D+1],…S[N],(S[1],S[2]…,S[D-1]) depending on value of (D mod N) ?

(Or did I misunderstood the question, why the NlogN complexity ?)

Well, I don’t this is anything I’ve already seen anywhere. We could surely keep this as the cakewalk problem (supposing I’ve not misunderstood the question).

Yes, you are right. i had another solution in mind, and failed to see this problem had become so easy. I’ll add another problem.

//