solve(s, k) — s has uppercase letters. You may replace at most `k` characters
with any other uppercase letter. Return the length of the longest substring that can be made
of a single repeated letter.
Use a sliding window. A window [left, right] is valid whenwindow length - (count of its most frequent letter) <= k — the letters that are not the
majority are the ones to replace. Expand right one step at a time; when the window becomes
invalid, move left forward. You never need to *shrink* maxCount: a smaller count cannot
produce a longer answer than the best one already seen.
Examples
solve("ABAB", 2) → 4
solve("AABABBA", 1) → 4
solve("ABCDE", 0) → 1Sample tests