#include <iostream>
#include <bits/stdc++.h>
#include <string.h>


using namespace std;

bool isPalindrome(string S)
{
    string P = S;

    reverse(P.begin(), P.end());

    if (S == P) {
        return true;
    }
    else {
        return false;
    }
}

int main()
{
    string t;
    cin >> t;
    int n;
    int resenje = 0;
    int broj_preostalih_slova = 0;

    n = t.size();

    broj_preostalih_slova = n;

    int i,index;
    for(i=0;i<n;i++){
        if(t[i] == 'b'){
            index = i;
            break;
        }
    }


    if(isPalindrome(t)){
        cout << 1;
        return 0;
    }

    else{
         resenje = abs(n/2 - index) + 1;
         cout << resenje;
    }





    return 0;
}