using LIB; using System; using System.Linq; using System.Text; using System.Collections.Generic; class Program { static bool loop(string s) { int cnt = s.Count(); bool ret = true; for (int i = 0; i < cnt / 2; i++) { if (s[i] != s[cnt - 1 - i]) { ret = false; break; } } return ret; } static void Main(string[] args) { string s = io.r(); int len = s.Count(); int output = 0; for (int i = 0; i < len; i++) { for (int j = 0; j < i; j++) { string ss = s.Substring(0, i - j); if (loop(ss)) { if (output < ss.Count() && ss.Count() != len) { output = ss.Count(); } } } for (int j = i + 1; j <= len; j++) { string ss = s.Substring(i, j - i); if (loop(ss)) { if (output < ss.Count() && ss.Count() != len) { output = ss.Count(); } } } } io.w(output); io.wflush(); } } namespace LIB { public class io { private const int WMAX = 1000; private static StringBuilder S = new StringBuilder(); public static T r() { return util.parse(r()); } public static T[] r(char s = ' ') { return r().Split(s).Select(util.parse).ToArray(); } public static T[] r(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r(); } return r; } public static T[][] r(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r(s); } return r; } private static string r() { return Console.ReadLine(); } public static void w(object v, bool lf = true) { S.Append(util.parse(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } } public static void wflush() { Console.Write(S.ToString()); S.Clear(); } } public class util { public static T parse(object value) { return (T)(Convert.ChangeType(value, typeof(T))); } } public class memo { private Dictionary R; public memo() { R = new Dictionary(); } public Result exec(Key k, Func f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; } } }