import std.algorithm; import std.array; import std.conv; import std.math; import std.stdio; import std.string; import std.range; int readint() { return readln.chomp.to!int; } int[] readints() { return readln.split.map!(to!int).array; } ulong calc(string s) { for (ulong i = s.length - 1; i > 0; i--) { // 回文の長さ for (int j = 0; j < s.length; j++) { // 回文の開始位置 int front = j; int back = cast(int)(front + i - 1); if (back >= s.length) break; bool found = true; while (front <= back) { if (s[front] != s[back]) { found = false; break; } front++; back--; } if (found) { return i; } } } return 1; } void main() { auto s = readln.chomp; writeln(calc(s)); }