using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Palindrom_safl
{
    class Program
    {
        static int RecOdLevo(string s, int brojac, int[] brojSlova)
        {
            char c = s.ElementAt(0);
            if (brojSlova[c - 97] / 2 > 0)
            {
                brojac++;
                brojSlova[c - 97] -= 2;
                return RecOdLevo(s.Substring(1), brojac, brojSlova);
            }
            return brojac;
        }
        static int RecOdDesno(string s, int brojac, int[] brojSlova)
        {
            char c = s.ElementAt(s.Length - 1);
            if (brojSlova[c - 97] / 2 > 0)
            {
                brojac++;
                brojSlova[c - 97] -= 2;
                return RecOdDesno(s.Substring(0, s.Length - 1), brojac, brojSlova);
            }
            return brojac;
        }
        static void Main(string[] args)
        {
            Console.SetIn(new StreamReader(Console.OpenStandardInput(), Console.InputEncoding, false, 2096952));
            string t = Console.ReadLine();
            char[] a = t.ToCharArray();
            if (Enumerable.SequenceEqual(a, a.Reverse())) Console.WriteLine(1);
            else
            {
                string s = "";
                int[] brojSlova1 = new int[26];
                int[] brojSlova2 = new int[26];
                int pomocniint = 0;
                for (int i = 0; i < a.Length; i++)
                {
                    brojSlova1[Convert.ToInt32(a[i]) - 97]++;
                    brojSlova2[Convert.ToInt32(a[i]) - 97]++;
                    if (pomocniint == 0 && (a[i] != a[a.Length - 1 - i]))
                    {
                        s = t.Substring(i, a.Length - 2 * i);
                        pomocniint++;
                    }
                }
                int brojac1 = 0;
                int brojac2 = 0;
                Console.WriteLine(Math.Min(s.Length - RecOdLevo(s, brojac1, brojSlova1), s.Length - RecOdDesno(s, brojac2, brojSlova2)));
            }
        }
    }
}