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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Unification
            string s = Console.ReadLine();

            string unified = GetUnifiedString(s);

            Console.WriteLine(s.Length - unified.Length);
        }

        static string GetUnifiedString(string s)
        {
            while (true)
            {
                int length = s.Length;

                s = s.Replace("01", "");
                s = s.Replace("10", "");

                if (s.Length == length)
                {
                    break;
                }
            }

            return s;
        }
    }
}