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

class Solution
{
    static Dictionary<Tuple<int, int>, int> cache = new Dictionary<Tuple<int, int>, int>();

    static int GetMinPattern(string s, int start, int length)
    {
        var key = Tuple.Create(start, length);
        if(cache.ContainsKey(key))
        {
            return cache[key];
        }

        var min = int.MaxValue;
        if (length == 1)
        {
            min = 1;
        }
        else
        {
            var count = new int['z' - 'a' + 1];
            foreach (var c in s.Skip(start).Take(length))
            {
                count[c - 'a']++;
            }

            if (count.Count(c => c % 2 == 1) <= 1)
            {
                min = 1;
            }
            else
            {
                for (int i = 1; i < length; i++)
                {
                    var x = GetMinPattern(s, start, i) + GetMinPattern(s, start + i, length - i);
                    min = Math.Min(min, x);
                }
            }
        }

        cache[key] = min;
        return min;
    }

    static void Main()
    {
        var s = Console.ReadLine();
        var n = GetMinPattern(s, 0, s.Length);
        Console.WriteLine(n);
    }
}