I have understood the question but i am not able to understand how to approach this problem.
Not able to understand
@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.