using System;
using System.Linq;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine();
        var reg = new Regex("(01|10)");
        int i = 0;
        var ss = s;
        while (true)
        {
            var newS = reg.Replace(ss, "");
            if (newS == ss)
            {
                break;
            }
            ss = newS;
        }
        Console.WriteLine(s.Length - ss.Length);
    }
}