using static System.Math; using System; public class Hello { static void Main() { var s = Console.ReadLine().Trim(); getAns(s); } static int check2(string s, int p) { var sL = s.Length; var d = 0; var count = 0; while (true) { if (p + d + 1 == sL | p - d < 0) break; if (s[p - d] == s[p + d + 1]) count += 2; else break; d++; } return count; } static int check1(string s, int p) { var sL = s.Length; var d = 1; var count = 1; while (true) { if (p + d == sL | p - d < 0) break; if (s[p + d] == s[p - d]) count += 2; else break; d++; } return count; } static void getAns(string s) { var sL = s.Length; var ans = 1; for (int i = 0; i < sL; i++) { var t0 = check1(s, i); var t1 = check2(s, i); if (t0 != sL) ans = Max(ans, t0); if (t1 != sL) ans = Max(ans, t1); } Console.WriteLine(ans); } }