Just put the cout
outside the for
loop, like this:
for (size_t i = 0; i < boo.size(); i++)
{
while (boo[i] == 'a')
{
count+=i+1;
if(count>b)
b=count;
// cout<<<<"a="<<b<<"\n";; //remove from here
break;
}}
//add here
cout<<<<"a="<<b<<"\n";;
1
solved Cout the last result only?