Блог пользователя shreyya_matade

Автор shreyya_matade, история, 3 года назад, По-английски

problem no: 1146A sub id: 128881280 code:

include

include

include

include

include<bits/stdc++.h>

using namespace std;

int main() { string a; int res; cin>>a;

int c=count(a.begin(),a.end(),'a');

int len=a.size(); int val=len-c;

if(val<c) res=val+c; else res=val-c;

cout<<res;

}

  • Проголосовать: нравится
  • -24
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Check if the following update fixes your solution.

if(val<c) res=val+c; else res=2*c-1;