class HelloWorld {
    public static void main(String[] args) {
      //双层循环 截所有的串 判断串是不是回文串  记录长度取最大
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        int len = s.length();
        int res = 0;
        //System.out.println(isHw("abba"));
        for (int i = 0; i < len; i++) {
            for (int j = i + 1; j <= len; j++) {
                String sb = s.substring(i, j);
                System.out.println(sb);
                if (isHw(sb)) {
                    res = Math.max(res,sb.length());
                }
            }
        }
        System.out.println(res);
    }
      static boolean isHw(String ss) {
        int s = 0, end = ss.length() - 1;
        while (s <= end) {
            if (ss.charAt(s) != ss.charAt(end)) {
                return false;
            }
            s++;
            end--;
        }
        return true;
    }
}