using System;

namespace AtCoder20190303_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            Console.WriteLine(RemovedBlocksNum(s));
        }

        public static int RemovedBlocksNum(string numbers)
        {
            int result = 0;
            for (int i = 1; i < numbers.Length; i++)
            {
                char prevNum = numbers[i - 1];
                if ((prevNum == '0' && numbers[i] == '1')
                    || (prevNum == '1' && numbers[i] == '0'))
                {
                    int removedNum = RemovedBlocksNum(numbers.Remove(i - 1, 2));
                    result = (result < removedNum + 2) ? removedNum + 2 : result;
                }
            }
            return result;
        }
    }
}
