using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iS = sS.Length;
            int iD = 0;
            while (true)
            {
                sS = sS.Replace("01", "");
                sS = sS.Replace("10", "");
                if (iS == sS.Length) { break; }
                else { iD += iS - sS.Length; }
                iS = sS.Length;
            }

            // 出力
            System.Console.WriteLine("{0}", iD.ToString());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}
