Not able to understand

I have understood the question but i am not able to understand how to approach this problem.

@lalchetna03 try to think about sliding window approach that window can contain atmost ‘K’ ‘a’ . Then calculate maximum substring of b/ maxlength of window. Similarly for a.