(Did I not already make this comment?)
This loop would be clearer as 2 steps. The first step should be the normal "advance to nth character" loop.
The second step should conditionally bump i as needed. Actually, a comment would be useful here because I am not sure why this case is special.