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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string inputs = Console.ReadLine();
            char[] s = inputs.ToArray();

            Dictionary<string, int> abCounter1 = new Dictionary<string, int>();
            Dictionary<string, int> abCounter2 = new Dictionary<string, int>();

            List<string> abList1 = new List<string>();
            List<string> abList2 = new List<string>();

            char[] firstChar = new char[] { s[0] };
            abList2.Add(new string(firstChar));

            bool b = true;
            for (int i = 0; i < inputs.Length - 1; i++)
            {
                char[] csi = new char[] { s[i], s[i + 1] };

                string si = new string(csi);

                if (b)
                {
                    if (abCounter1.ContainsKey(si))
                    {
                        abCounter1[si]++;
                    }
                    else
                    {
                        abCounter1.Add(si, 1);
                    }
                    abList1.Add(si);
                }
                else
                {
                    if (abCounter2.ContainsKey(si))
                    {
                        abCounter2[si]++;
                    }
                    else
                    {
                        abCounter2.Add(si, 1);
                    }
                    abList2.Add(si);
                }

                b = !b;
            }
            if (inputs.Length % 2 == 1)
            {
                char[] lastChar = new char[] { s[inputs.Length - 1] };
                abList1.Add(new string(lastChar));
            }
            else
            {
                char[] lastChar = new char[] { s[inputs.Length - 1] };
                abList2.Add(new string(lastChar));
            }

            int same1, same2;
            int diff1, diff2;

            Check(abCounter1, out same1, out diff1);
            Check(abCounter2, out same2, out diff2);

            //Console.WriteLine(same1.ToString() + "  " + diff1.ToString());
            //Console.WriteLine(same2.ToString() + "  " + diff2.ToString());

            if (diff1 > diff2)
            {
                Console.WriteLine(KCount(abList1, abCounter1));
            }
            else if (diff1 == diff2)
            {
                if (same1 <= same2)
                {
                    Console.WriteLine(KCount(abList1, abCounter1));

                }
                else
                {
                    Console.WriteLine(KCount(abList2, abCounter2));
                }
            }
            else
            {
                Console.WriteLine(KCount(abList2, abCounter2));

            }


        }


        public static int KCount(List<string> str, Dictionary<string, int> dict)
        {
            int k = 0;
            for (int i = 0; i < str.Count; i++)
            {
                if (dict.ContainsKey(str[i]))
                {
                    if (dict[str[i]] > 1)
                    {
                        k += 2;

                    }
                    else
                    {
                        k++;
                    }
                }
                else
                {
                    k++;
                }

            }

            return k;

        }

        public static void Check(Dictionary<string, int> dict, out int same, out int diff)
        {
            same = 0;
            diff = 0;
            foreach (KeyValuePair<string, int> kvp in dict)
            {
                if (kvp.Value > 1)
                {
                    if (kvp.Key[0] == kvp.Key[1])
                    {
                        same++;
                    }
                    else
                    {
                        diff++;
                    }
                }
            }

        }
    }
}
