using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Yuki { class Program { static void Main(string[] args) { string s = Console.ReadLine(); string a; int max = s.Length == 2 && s[0].Equals(s[1]) ? 1 : 0; for (int i = 0; i < s.Length; i++) { a = s[i].ToString(); for (int j = i + 1; j < s.Length; j++) { a += s[j]; if (a.Length == s.Length) break; char[] b = a.ToCharArray(); Array.Reverse(b); if (a.Equals(new string(b)) && a.Length > max) max = a.Length; } } if (max == 0) { for (int i = 0; i < s.Length; i++) { if (s.Where(x => x == s[i]).Count() >= 2) { max = 1; break; } } } Console.WriteLine(max); } } }