#include <iostream>
using namespace std;

int main() {
    string line;
    cin >> line;
    int count = 0;
    int index;
    for (int i = 0; i < line.length(); i++)
    {
        if (line.at(i) != line.at(line.length() - i - 1))
        {
            count++;
            index = (int) line.length() - i;
        }
    }
    string substring = line.substr(index, count);
    int answer = (int) substring.length();
    if (substring.length() == 0) {
        answer = 1;
    }
    cout << answer << endl;
    return 0;
}