import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip, std.datetime;

bool is_p(string s) {
    int n = s.length.to!int;
    foreach (i; 0..n/2) if (s[i] != s[n-i-1]) return false;
    return true;
}

void main() {
    auto S = readln.chomp;
    auto N = S.length.to!int;

    foreach_reverse (i; 1..N+1) {
        foreach (j; 0..N-i+1) {
            if (!is_p(S[j..j+i])) {
                writeln(i);
                return;
            }
        }
    }

    writeln(0);
}
