0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-27 10:11:58 +00:00
OI-codes/Luogu/problem/CF1146A/CF1146A.cpp
2021-01-02 15:30:52 +08:00

17 lines
244 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
char c;
int n = 0, a = 0;
while (cin >> c) {
n++;
if (c == 'a') {
a++;
}
}
cout << min(a * 2 - 1, n) << endl;
return 0;
}