04 Try it yourself Interactive
Two pointer walks over the same input, in opposite directions. Two pointers starts at both ends and converges: the amber band is the live window, a dashed cell is a character being stepped over, green is a matched pair, red is a mismatch. Expand centre starts from one centre and grows outward, trying every one of the 2n − 1 centres — 13 of them for the seven letters of the default example — with a green underline on the longest span found so far. It works on the stripped, lowercased string, so the cells change when you switch tabs. Nothing moves on its own — press Next, or use the arrow keys.