AdvancedRating 1500
At Most K Distinct
Print the length of the longest substring with at most k distinct characters.
Input
A string, then k ≥ 1.
Output
A length.
Sample 1
Input
eceba 2
Output
3
Sample 2
Input
aa 1
Output
2
Output appears hereA string, then k ≥ 1.
A length.
eceba 2
3
aa 1
2
Output appears here