Special String(didnot understand the approach)

Hello everyone,

I am trying to solve this question, but not able to understand what actually is going on . Also the example has no explanation, Can anyone please briefly describe what actually is going in the question, and explain it clearly with one example .

Question link