Same issue here. The string had 8 characters but for some reason, in my iteration x reached 9. But it happened only once, as soon as I placed breakpoints to debug, the bug disappeared and it now stops at 8 as expected…