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

namespace D
{
    class Program
    {
        static Dictionary<string, int> dict;
        static int Recur(string str)
        {
            if (dict.ContainsKey(str))
            {
                return dict[str];
            }
            if (str.Length <= 1)
            {
                dict.Add(str, 1);
                return 1;
            }
            if (isParin(str))
            {
                dict.Add(str, 1);
                return 1;
            }

            dict.Add(str, str.Select((_, i) => (i == 0 || i >= str.Length - 1) ? 100000 : Recur(str.Substring(0, i + 1)) + Recur(str.Substring(i + 1))).Min());
            return dict[str];
        }

        static bool isParin(string str)
        {
            int[] c = new int[26];
            foreach (var v in str)
            {
                c[v - 'a']++;
            }
            return c.All(x => x % 2 == 0) || c.Where(x => x % 2 == 1).Count() == 1;
        }

        static void Main(string[] args)
        {
            dict = new Dictionary<string, int>();
            string input = Console.ReadLine();
            Recur(input);
            Console.WriteLine(dict[input]);
#if DEBUG
            Console.ReadKey();
#endif
        }
    }
}
