#include
#include
using namespace std;
int main()
{
int k=2;
string s="abbbaa";
int left=0,ans=0,co[2]={0};
for(int i=0;i<s.length();i++)
{
char c=s[i];
co[c-'a']++;
//not able to understant the logic below this line of code
if(min(co[0],co[1])>k)
{
co[s[left]-'a']--,left++;
cout<<left;
}
else{ans++;}
}cout<<ans;
}