#include <iostream>

using namespace std;

int main()
{
    string rec;
    cin >> rec;
    int duzina = rec.length()-1;
    int x1=0, x2=0, x1broj=0, x2broj=0, resenje=0, x=0;
    
    for(int i=0; i<duzina;i++)
    {
        if(rec[i] != rec[duzina])
        {
            x1=i;
            x2=duzina;
            x=1;
            break;
        }
        else if(rec[i] == rec[duzina])
        {
            resenje += 2;
        }
        duzina--;
    }
    
    for(int i=x1; i<x2;i++)
    {
        if(rec[x1]==rec[i])
        {
            x1broj++;
        }
        if(rec[x2]==rec[i])
        {
            x2broj++;
        }
    }
    
    if(x == 0)
    {
        cout << 1;
    }
    else if((x1broj%2==0)||(x2broj%2==0))
    {
        cout << rec.length()-resenje-1;
    }
    else if((x1broj%2==0)&&(x2broj%2==0))
    {
        cout << rec.length()-resenje-1;
    }
    else
    {
        cout << rec.length()-resenje;
    }
    
    return 0;
}