Sanket and strings

what’s wrong with this code?

//#include “iostream”

//#include"string"

//#include"algorithm"
using namespace std;

int main() {

string s;
int k;
cin>>k>>s;
int n=s.length();
int char_counts[26];
int window_start=0;
int max_length=0;
int max_count=0;
for(int window_end=0;window_end<n;window_end++)
  {
          char_counts[s.at(window_end)-'a']++;
          int current_char_count=char_counts[s.at(window_end)-'a'];
          max_count=max(max_count,current_char_count);

          while(window_end-window_start-max_count+1>k)
          {
                  char_counts[s.at(window_start)-'a']--;
                  window_start++;
          }
          max_length=max(max_length,window_end-window_start+1);
  }
  cout<<max_length;
  return 0;

}

@p8847220 for the test case
2
aabbaababba

answer is supposed on 6, but your code is giving 11