Please read the new rule regarding the restriction on the use of AI tools. ×

1146A

Revision en1, by wzq2009, 2020-02-08 04:24:44

This is my answer for 1146A:

include <bits/stdc++.h>

using namespace std; int main(){ string s; cin>>s; int cnta=0; for(int i=0;i<s.size();i++){ if(s[i]=='a'){ cnta++; } } if(cnta>(s.size()-cnta)){ cout<<s.size();return 0; } cout<<cnta+(cnta-1); return 0; }

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English wzq2009 2020-02-08 04:24:44 303 Initial revision (published)