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

wzq2009's blog

By wzq2009, history, 5 years ago, In English

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; }

  • Vote: I like it
  • -18
  • Vote: I do not like it