recursive checking for contiguously colored chains