#include <stdio.h>

int main()
{
    char str[200000] = {};

    gets(str);

    int n = strlen(str);
    int DuzinaPodNiske = 1;
    char NeparanKarakter = NeparanChar(str);

    for (int i = 0, j = n - 1; i < n / 2; ++i, --j)
    {
        if (str[i] != str[j])
        {
            DuzinaPodNiske = n - 2 * i - (str[i] == NeparanKarakter || str[j] == NeparanKarakter);
            break;
        }
    }

    printf("%d", DuzinaPodNiske);
}

int NeparanChar(char str[])
{
    int n = strlen(str);
    int alphabet[26] = {};

    for (int i = 0; i < n; ++i)
    {
        alphabet[str[i] - 'a']++;
    }

    for (int i = 0; i < 26; ++i)
    {
        if (alphabet[i] % 2 == 1)
        {
            return i + 'a';
        }
    }

    return 0;
}