#include <iostream>
#include <string>

int main()
{
    std::string rec;
    std::cin >> rec;

    int duzina = rec.length();
    int start, end;
    for (int i = 0; i < (duzina / 2) + (duzina % 2); i++) {
        int temp = duzina - i;
        if (rec[i] != rec[temp - 1]) {
            start = i + 1;
            end = temp;
            break;
        }
        start = 0;
        end = 1;
    }

    std::cout << end - start;

}