using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

public class Monoid<T>
{
    public T Unit { get; private set; }
    Func<T, T, T> append;
    public T Append(T left, T right) => append(left, right);

    public Monoid(T unit, Func<T, T, T> append)
    {
        this.Unit = unit;
        this.append = append;
    }
}

public class Group<T> : Monoid<T>
{
    Func<T, T, T> appendInv;
    public T AppendInv(T left, T right) => appendInv(left, right);

    public Group(T unit, Func<T, T, T> append, Func<T, T, T> appendInv)
        : base(unit, append)
    {
        this.appendInv = appendInv;
    }
}

public class BinaryIndexedTree<T>
{
    T[] tree;

    public readonly int N;
    public readonly Monoid<T> Monoid;
    readonly bool supportsGroup = false;

    // O(N)
    public BinaryIndexedTree(int n, Monoid<T> monoid)
    {
        N = n;
        Monoid = monoid;
        tree = Enumerable.Repeat(monoid.Unit, n + 1).ToArray();
    }

    // O(N)
    public BinaryIndexedTree(IEnumerable<T> collection, Monoid<T> monoid)
    {
        N = collection.Count();
        Monoid = monoid;
        tree = new T[N + 1];
        for (var i = 0; i < N; i++) tree[i + 1] = collection.ElementAt(i);
        for (var i = 1; i < N; i++)
        {
            var j = i + (i & -i);
            if (j < N) tree[j] = monoid.Append(tree[j], tree[i]);
        }
    }

    // O(N)
    public BinaryIndexedTree(int n, Group<T> group)
        : this(n, (Monoid<T>)group)
    {
        supportsGroup = true;
    }

    // O(N)
    public BinaryIndexedTree(IEnumerable<T> collection, Group<T> group)
        : this(collection, (Monoid<T>)group)
    {
        supportsGroup = true;
    }

    public T this[int i]
    {
        // O(log N)
        get { return this[i, i]; }

        // O(log N)
        set
        {
            if (!supportsGroup) throw new InvalidOperationException();
            var group = (Group<T>)Monoid;
            Append(i, group.AppendInv(value, this[i]));
        }
    }

    public T this[int i, int j]
    {
        // O(log N)
        get
        {
            if (!supportsGroup) throw new InvalidOperationException();
            var group = (Group<T>)Monoid;
            var acc = group.Unit;
            j++;
            for (; j > i; j -= j & -j) acc = group.Append(acc, tree[j]);
            for (; i > j; i -= i & -i) acc = group.AppendInv(acc, tree[i]);
            return acc;
        }
    }

    // O(log N)
    public T Concat(int i)
    {
        var acc = Monoid.Unit;
        for (i++; i > 0; i -= i & -i) acc = Monoid.Append(acc, tree[i]);
        return acc;
    }

    // O(log N)
    public void Append(int i, T d)
    {
        for (i++; i <= N; i += i & -i) tree[i] = Monoid.Append(tree[i], d);
    }
}

static class Extentions
{
}

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static bool CanBePalindrome(IEnumerable<int> cnts) => cnts.Count(x => x % 2 == 1) <= 1;

    static void Solve(IO io)
    {
        var s = io.S;
        var bit = new BinaryIndexedTree<int>[26];

        for (var i = 0; i < 26; i++)
        {
            bit[i] = new BinaryIndexedTree<int>(s.Length,
                new Group<int>(0, (x, y) => x + y, (x, y) => x - y));

            for (var j = 0; j < s.Length; j++) if (s[j] == i + 'a') bit[i][j] = 1;
        }

        var dp = new long?[s.Length];

        Func<int, long> Search = null; Search = i =>
        {
            if (i == s.Length - 1) return 1;
            if (i > s.Length - 1) return 0;
            if (dp[i].HasValue) return dp[i].Value;

            var tail = s.Substring(i);
            var r = 1145141919810L;

            for (var j = tail.Length - 1; j >= 0; j--)
            {
                var tmp = 0;
                for (var k = 0; k < 26; k++) if (bit[k][i, i + j] % 2 == 1) tmp++;
                if (tmp <= 1) r = Min(r, 1 + Search(i + j + 1));
            }

            return (dp[i] = r).Value;
        };

        var ans = Search(0);
        io.Write(ans);
    }
}