#include <bits/stdc++.h>
using namespace std;
int Resi(string s){

int n=s.size();

int index=-1;
for(int i=0;i<n/2;i++){
if(s[i]!=s[n-i-1]){index=i;break;}

}

vector <bool> pal(n);
for(int i=0;i<n;i++){
    pal[i]=(s[i]==s[n-i-1]);
}
for(int i=n/2-1;i>=0;i--){
    pal[i]=pal[i]&&pal[i+1];
    pal[n-i-1]=pal[n-i-1]&&pal[n-i-2];
}


if(index==-1){
 //   cout <<1<<endl;
    return 1;
}
    vector <int> a(26);


int rez=1;
vector <int> b(26);
a[s[n-index-1]-'a']++;
b[s[index]-'a']++;

for(int i=index+1;i<=n-index-1;i++){
        bool gotovo=true;
        bool found=false;

if(!pal[i]&&i<n/2){gotovo=false;}
//cout <<"iter: "<<s<<endl;
for(int j=0;j<26;j++){
    if(j<4)
    //cout <<a[j]<<" "<<b[j]<<endl;
    if(a[j]>b[j]){gotovo=false;break;}
    if((b[j]-a[j])%2==1){
        if(found){gotovo=false;break;}
        found=true;
    }
}
if(gotovo){//cout <<"AAA"<<endl;
    break;}
if(i<n/2){
a[s[n-i-1]-'a']++;
}
if(i>n/2){
    a[s[i]-'a']--;

}
b[s[i]-'a']++;
rez++;
}
//cout <<rez<<endl;
return rez;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
string s;
cin >>s;
string sp=s;
reverse(sp.begin(),sp.end());
cout <<min(Resi(s),Resi(sp))<<endl;
}