using System;

namespace C_Unification
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            int cnt = 0;

            while(true)
            {
                string str = string.Empty;

                for (int i = 1; i < S.Length; i++)
                {
                    if (S[i - 1] != S[i])
                    {
                        cnt += 2;
                        i++;
                    }
                    else str += S[i - 1].ToString();
                }

                if (S == str) break;
                else S = str;
            };

            Console.WriteLine(cnt);
        }
    }
}
