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

namespace atcorder_BeginnerContest_120
{
    class Program
    {

        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            int ret = 0;

            while (true)
            {
                bool endFlg1 = false;
                bool endFlg2 = false;

                int len1 = str.Length;
                str = str.Replace("10", "");
                int len2 = str.Length;
                ret += len1 - len2;
                if (len1 == len2)
                {
                    endFlg1 = true;
                }

                str = str.Replace("01", "");
                int len3 = str.Length;
                ret += len2 - len3;
                if (len2 == len3)
                {
                    endFlg2 = true;
                }

                if (endFlg1 && endFlg2)
                {
                    break;
                }
            }

            Console.WriteLine(ret);

        }
    }
}
