i should clarify, the problem that stood out to me is the initial value of the index is never used in the body of the loop. that's what makes this thing so awful. the loop "works", but then you're left chasing an off-by-one error.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.