#include <iostream>
#include <string>

using namespace std;

int main()
{
    string a;
    int b[123];
    int c, p1, p2;
    char t;

    cin >> a;
    c = a.size();
    for(int i = 0; i < 123; i++)
    {
        b[i] = 0;
    }
    for(int i = 0; i < c; i++)
    {
        p1 = a[i];
        b[p1]++;
    }
    for(int i = 97; i < 123; i++)
    {
        if(b[i] % 2 != 0)
            t = i;
    }

    c = a.size();
    c--;
    p1 = -1;
    p2 = -1;
    for(int i = 0; i <= c/2; i++)
    {
        if(a[i] != a[c])
        {
            if(a[i] == t)
                p1 = i;
            else
            {
                if(a[c] == t)
                    p2 = c;
                else if(p1 == -1)
                        p1 = i;
                     else
                        p2 = c;
            }
        }

        c--;
    }

    cout << p2 - p1 + 1 << endl;

    return 0;
}