Implement `longestKDistinct(s, k)` returning the length of the longest substring containing at most `k` distinct characters.
+ 1 hidden test run on Submit.
A window keyed by character counts keeps at most k distinct in O(n).
Run your code to see results.