04 Try it yourself Interactive

One index, walking the same word both ways

It opens on the same nine slots as section 02, and the dropdown swaps in shorter words — a palindrome, a word with no vowels at all, a word that is nothing but vowels. Count vowels walks the index left to right and collects what it finds. Reverse walks right to left and appends into a builder — and its rose stat counts what the naive result = result + c version would have copied to produce the identical answer. Three things move on every press: the cell the index sits on, the line of code responsible, and the sentence explaining it.

Count vowels
i walks 0 → n-1
Letters only, 2 to 12 of them. Y does not count as a vowel here.
Press Next to begin. Each press moves the index one slot.


      
Index i
Character
Vowels0
Consonants0
step 0 / 0