using static System.Math; using System; public class Hello { static void Main() { var s = Console.ReadLine().Trim(); getAns(s); } static int check1(string s, int n, int p) { var d = 0; var res = 0; while (p + d < n && p - d - 1 >= 0) { if (s[p + d] == s[p - d - 1]) res += 2; d++; } return res; } static int check0(string s, int n, int p) { var d = 1; var res = 1; while (p + d < n && p - d >= 0) { if (s[p + d] == s[p - d]) res += 2; d++; } return res; } static void getAns(string s) { var ans = 0; var n = s.Length; for (int i = 0; i < n; i++) { ans = Max(ans, check0(s, n, i)); ans = Max(ans, check1(s, n, i)); } Console.WriteLine(ans); } }