Advertisement
Guest User

CF A

a guest
Apr 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int l,re;
  6. size_t ant;
  7. string q;
  8. cin>>q;
  9. l=q.length();
  10. ant=count(q.begin(),q.end(),'a');
  11. if(ant>(l-ant))cout<<l<<endl;
  12. else{
  13. re=ant+ant-1;
  14. cout<<re<<endl;
  15. }
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement