import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	string s;
	while ((s = readln.strip) != "")
	{
		auto n = s.length.to !(int);
		int res = 0;
		foreach (i; 0..n)
		{
			foreach (j; i + 1..n + 1)
			{
				auto t = s[i..j];
				if (!equal (t, t.retro))
				{
					res = max (res, t.length.to !(int));
				}
			}
		}
		writeln (res);
	}
}
