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

Full text and comments »

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