Implement `longestKDistinct(s, k)` returning the length of the longest substring containing at most `k` distinct characters.
Run your code to see results.