using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace No273 { class MainClass { public static void Main (string[] args) { var s = Console.ReadLine (); int maxMatch = 1; for (int i = 1; i < s.Length; i++) { for (int k = i + 1; k < s.Length; k++) { bool match = true; for (int j = 0; j + i <= k; j++) { if (s [i + j] != s [k - j]) { match = false; break; } } if (match) { maxMatch = Math.Max (maxMatch, k - i + 1); } } } for (int i = 0; i < s.Length - 1; i++) { for (int k = i + 1; k < s.Length - 1; k++) { bool match = true; for (int j = 0; j + i <= k; j++) { if (s [i + j] != s [k - j]) { match = false; break; } } if (match) { maxMatch = Math.Max (maxMatch, k - i + 1); } } } Console.WriteLine (maxMatch.ToString ()); } } }