Longest single-letter run with k edits
Given a string s of uppercase letters and an integer k, you may change at most k characters of s, each to any letter you like. Return the length of the longest contiguous substring that can end up made of a single repeated letter.
s may be empty and k >= 0. Aim for one pass over s.
Besides the tests, one large input (a 3,000-letter string) with a ~300 ms limit (scaled to your device's speed): brute force won't pass.
Examples
longest_uniform("BAAABCB", 1)→4longest_uniform("XYXY", 2)→4longest_uniform("AABAA", 1)→5