The insight: you don't remove stones. You count matching adjacent pairs. That count IS your answer because each violation needs exactly one removal. Find 3 matching pairs? Remove 3 stones.
Let me show an example. RRGGB has two violations: positions 0-1 (RR) and 2-3 (GG). Remove one R and one G, leaving RGB. Two violations equals two removals. This pattern always holds. This transforms a complex simulation into a counting loop.
Walk the string, compare each stone with its neighbor, increment when they match. No removals needed.