#include <iostream>

using namespace std;

#include <bits/stdc++.h>

int palindrom(string s)
{
    string s1 = s;
 
    reverse(s1.begin(), s1.end());
 
    if (s == s1) {
        return 1;
    }
    else {
        return 0;
    }
}

int main() {
    int x,j,sz,i;
    string s;
    cin >> s;
    i = palindrom(s);
    if (i == 1){
        x = 1;
    }
    else{
    sz = s.size() - 1;
    for (j = sz - 1; j >= 0; j--){
    
        if (s[j] != s[sz - j])
        {
            x = j - (sz - j);
            break;
        }
    }}
    cout << x;
    return 0;
}