
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Instead of shifting every character in each shift, could you keep track of which characters are shifted and by how much across all shifts?
Try marking the start and ends of each shift, then perform a prefix sum of the shifts.