# Longest Repeating Character Replacement - <https://leetcode.com/problems/longest-repeating-character-replacement/> - Maintaining the properties of the window. ```python counter = Counter() w = max_len = start = max_count = 0 for c in s: w += 1 counter[c] += 1 if max_count < counter[c]: max_count = counter[c] if w - max_count > k: counter[s[start]] -= 1 start += 1 w -= 1 else: max_len = w if max_len < w else max_len return max_len ```