using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            char[] p = s.ToCharArray();
            List<char> a = new List<char>();
            List<int> b = new List<int>();
            List<int> c = new List<int>();
            for (int i = 0; i < p.Length; i++)
            {
                if (!a.Contains(p[i]))
                {
                    a.Add(p[i]);
                    b.Add(1);
                    c.Add(0);
                }
                else
                {
                    b[a.IndexOf(p[i])]++;
                }
            }
            int j = 0;
            for (int i = 0; i < p.Length / 2; i++)
            {
                if (p[i] == p[p.Length - i - 1])
                {
                    j++;
                    b[a.IndexOf(p[i])] -= 2;
                }
                else
                    break;
            }
            int l = 0;
            for (int i = j; i < p.Length / 2 + 1; i++)
            {
                c[a.IndexOf(p[i])]++;
                if (c[a.IndexOf(p[i])] * 2 > b[a.IndexOf(p[i])])
                    break;
                else
                    l++;
            }
            int d = 0;
            for (int i = 0; i < a.Count; i++)
            {
                c[i] = 0;
            }
            for (int i = p.Length - j - 1; i > p.Length / 2; i--)
            {
                c[a.IndexOf(p[i])]++;
                if (c[a.IndexOf(p[i])] * 2 > b[a.IndexOf(p[i])])
                    break;
                else
                    d++;
            }
            Console.WriteLine(p.Length - 2 * j - Math.Max(l, d));
        }
    }
}