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

namespace ConsoleApp18
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] S = Console.ReadLine().ToCharArray();

            while(true)
            {
                int count = 0;
                if (Remove(S) == false)
                {
                    Console.WriteLine(count);
                }
                else
                {
                    count++;
                }
            }
        }

        private static bool Remove(char[] source)
        {
            var list = source.ToList();
            
            var matchIndex = Enumerable.Zip(source, source.Skip(1), (first, second) => first == second).ToList().FindIndex(x => x);

            if (matchIndex == -1) return false;

            list.RemoveAt(matchIndex + 1);
            list.RemoveAt(matchIndex);

            return true;
        }
    }
}
