Longest stretch with at most k distinct letters
Write longest_k_distinct(text, k) that returns the length of the longest run of
consecutive characters containing at most k different characters. k is at least 1.
longest_k_distinct("eceba", 2) -> 3 ("ece")
longest_k_distinct("aa", 1) -> 2
longest_k_distinct("abcabc", 3) -> 6
The point is to practise a variable window whose state is a Counter of what is inside.
def longest_k_distinct(text, k):
...