using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.SymbolStore;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net.WebSockets;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
using System.Numerics;
//using System.Data;
//using System.Drawing;

namespace ConsoleApplication2
{
    class Program
    { 
        static int k(char c)
        {
            return (int)c - 97;
        }
        static int levinacin(string s, int i1, int i2, int pocminlen, int[] occ, int oddind)
        {
            bool proslilevo = true;
            bool proslidesno = true;
            while (i1 <= i2)
            {
                if (!(proslidesno || proslilevo))
                    break;
                if (occ[k(s[i1])] != 0 && proslilevo)
                {
                    pocminlen--;
                    occ[k(s[i1])] -= 2;
                    proslidesno = false;
                }
                else if (occ[k(s[i2])] != 0 && proslidesno)
                {
                    pocminlen--;
                    occ[k(s[i2])] -= 2;
                    proslilevo = false;
                }
                else break;
                i1++;
                i2--;
            }
            if (s.Length % 2 == 1)
                if (s[s.Length / 2] == Convert.ToChar(oddind + 97) && s.Length - pocminlen == s.Length / 2)
                    pocminlen--;
            return pocminlen;

        }
        static int desninacin(string s, int i1, int i2, int pocminlen, int[] occ, int oddind)
        {
            bool proslilevo = true;
            bool proslidesno = true;
            while (i1 <= i2)
            {
                if (!(proslidesno || proslilevo))
                    break;
                
                if (occ[k(s[i2])] != 0 && proslidesno)
                {
                    pocminlen--;
                    occ[k(s[i2])] -= 2;
                    proslilevo = false;
                }
                else if (occ[k(s[i1])] != 0 && proslilevo)
                {
                    pocminlen--;
                    occ[k(s[i1])] -= 2;
                    proslidesno = false;
                }
                else break;
                i1++;
                i2--;
            }
            if (s.Length % 2 == 1)
                if (s[s.Length / 2] == Convert.ToChar(oddind + 97) && s.Length - pocminlen == s.Length / 2)
                    pocminlen--;
            return pocminlen;
        }

        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int i1 = 0;
            int i2 = s.Length-1;        
            while(i1<i2 && s[i1]==s[i2])
            {
                i1++;i2--;
            }
            int pocminlen = i2 - i1 + 1;
            if(pocminlen==1)
            {
                Console.WriteLine(1);
                return;
            }
            else if(pocminlen==0)
            {
                Console.WriteLine(2);
                return;
            }
            int[] occ = new int[26];
            for(int i=i1;i<=i2;i++)
            {
                occ[k(s[i])]++;
            }
            int oddind = -1;
            if(pocminlen%2==1)
            {
                for(int i=0;i<occ.Length;i++)
                    if(occ[i]%2==1)
                    {
                        oddind = i;
                        break;
                    }
            }
            if (oddind != -1)
                occ[oddind]--;
            int[] pom = occ.ToArray();
            int levipo = levinacin(s, i1, i2, pocminlen, occ, oddind);
            int desnipo = desninacin(s, i1, i2, pocminlen, pom, oddind);
            Console.WriteLine(Math.Min(levipo,desnipo));
        }
    }
}