#include <bits/stdc++.h>

using namespace std;

int racuanje(int br, char t[], char *p, char *k)
{
    if (br == 1)
        return strlen(t);
    else
        return strlen(t) - br;
}

int palindrom(char t[], char *p, char *k)
{
    int br = 0;
    while (p < k)
    {
        if (*p != *k)
        {
            br++;
            break;
        }
        else
        {
            p++;
            k--;
            br += 2;
        }
        if (p >= k)
            return 1;
    }
    return racuanje(br, t, p, k);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cerr.tie(0);
    cout.tie(0);
    char t[200000];
    cin >> t;
    char *p = t, *k;
    int duzina = strlen(t);
    k = t + duzina - 1;
    cout << palindrom(t, p, k) << endl;
    return 0;
}