Check my code sanket and string

#include
#include
#include
using namespace std;
int main()
{
int k;
cin>>k;
string s1;
cin>>s1;
cin.get();
int len=s1.length();
int counta=0;
int countb=0;
for(int i=0;i<len;i++)
{
if(s1[i]==‘a’)
{
counta++;
}
else if(s1[i]==‘b’)
{
countb++;
}
}
for(int i=0;i<k;i++)
{
if(counta>=countb)
{
counta++;
}
else{
countb++;
}
}
int ms=max(counta,countb);
cout<<ms;

}

Your approach to the question is incorrect , you are required to use teh 2 pointer approach for the problem

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.