using System;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            int L = s.Length;
            int p = L;

            string t = s;

            while(true)
            {
                t = t.Replace("01", "").Replace("10", "");

                if(p == t.Length)
                {
                    Console.WriteLine((L - t.Length).ToString());
                    return;
                }

                p = t.Length;
            };

        }

    }
}
