using System;

namespace _20190304_05 {
    class Program {
        static void Main(string[] args) {
            var str = Console.ReadLine();
            var initialLength = str.Length;
            var n = 0;
            do {
                n = str.Length;
                str = str.Replace("01", "");
                str = str.Replace("10", "");
            } while (n != str.Length);
            Console.WriteLine(initialLength - str.Length);
        }
    }
}
