Updated: 2024-03-12 1 min read On This Pageclass Solution: def countKeyChanges(self, s: str) -> int: return sum(a.lower() != b.lower() for a, b in pairwise(s))