using System;
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine();
            var result = N;
            for(; ; )
            {
                result = result.Replace("01", "").Replace("10", "");
                if (!(result.Contains("01") || result.Contains("10"))) break;
            }
            Console.WriteLine(N.Length - result.Length);
        }}