#include <bits/stdc++.h>
using namespace std;
string s;
int nizl[1000000],nizd[1000000];

int main(){
    cin >> s;
    int velicina=s.size()-1;
    bool isti=true;
    int levi_levi=0,desni_desni=velicina;
    while(isti and levi_levi!=desni_desni and levi_levi+1!=desni_desni){
        if(s[levi_levi]!=s[desni_desni]){
            isti=false;
            break;
        }
        levi_levi++;
        desni_desni--;
    }
    if(isti==true){
        cout << 1 << endl;
        return 0;
    }
    isti=true;
    int levi_desni,desni_levi;
    int nesto=velicina+1;
    if((velicina+1)%2==1){
        levi_desni=nesto/2;
        desni_levi=nesto/2;
    }
    else {
        levi_desni=nesto/2-1;
        desni_levi=nesto/2;
    }
    //cout << levi_desni << " " << desni_levi <<endl;
    while(true){
        if(s[levi_desni]!=s[desni_levi]){
            break;
        }
        levi_desni--;
        desni_levi++;
    }
    cout << levi_levi << " " << levi_desni << " " << desni_levi << " " << desni_desni << endl;
    ///------Nadjeni svi pointeri ll ld dl dd

    for(int i=levi_levi;i<=levi_desni;i++){
        nizl[s[i]-96]++;
    }
    for(int i=desni_levi;i<=desni_desni;i++){
        nizd[s[i]-96]++;
    }
    /*for(int i=1;i<=26;i++){
        cout << nizl[i] <<" ";
    }
    cout << endl;
    for(int i=1;i<=26;i++){
        cout << nizd[i] <<" ";
    }
    cout << endl;
    */
   int res=0;
    if(levi_levi==levi_desni and desni_desni-levi_levi==desni_levi-levi_desni and velicina>2){
        cout << desni_levi-1<< endl;
        return 0;
    } 
    if(levi_levi==levi_desni){
        cout << desni_levi << endl;
        return 0;
    }
    for(int i=1;i<=26;i++){
        if(nizl[i]!=nizd[i]){
            for(int j=levi_levi;j<=desni_levi;j++){
                res++;
            }
            cout << res << endl;
            return 0;
        }
    }
    for(int j=levi_levi;j<=levi_desni;j++){
        res++;
    }
    cout << res << endl;
   

    return 0;
}