#include <bits/stdc++.h>
#include<string>
#include<string>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define ios ios_base::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
    ios;
    string s;
    cin>>s;
    int br=0;
    int p=-1,d=-1;
    int n = s.length();
    for(int i =0;i<n;i++){
        if(s[i]=='b'){
            if(p==-1)p=i;
            else {d=i;break;}
        }
    }
    int c = n-d;
    br=p-c;
    cout<<br+2;
    return 0;
}