[Community puzzle] KGood

Hi Guys,

I am solving the puzzle and for some of the test cases I do not see a possible solution.
For instance it seems that for test 4 the highest number of consecutive characters is 3 - “ttt”, and I do not understand how counting to 18 in any direction can result in the right answer which is 46.
Can anybody please clarify the puzzle statement a bit.
Thanks in advance.

The puzzle is after the longest substring that contains at most K unique letters (eg if K was 26 then it would always be the entire string). There isn’t any mention of consecutive identical characters.

Thanks for the clarification.
I misinterpreted the statement, counting the length of the substring resulting after K unique characters are encountered and aborting afterwards.
It works as expected now.