#include <bits/stdc++.h>
using namespace std;
int main(){
    char b=b;
    string t,u="joj";
    cin>>t;
    int br=0,f1,f2;//abaa a baaa
    if(t.size()%2==0){
        char b = 'b';
        f1 = t.find(b);
        if (f1 != string::npos)
            cout<<f1<<endl;
        f2 = t.find(b, f1+1);
        if (f2 != string::npos)
            cout<<f2<<endl;
        
    u=t;
    int m,s;
    m=t.size()/2;
    if(f1+1>=m||f1+1>=m+1){
        s=u.size();
        u.erase(f1+1,s);
        u.erase(0,s-f2-1);
        cout<<u.size();
    }
    if(f2-1<=m||f2-1<=m-1){
        s=u.size();
        u.erase(f2+1,s);
        u.erase(0,s-f2-1);
        cout<<u.size();
    }
    }
}