using System;
using System.Text.RegularExpressions;
class Program
{
    static void Main(string[] args)
    {
        // 解
        int ans = 0;

        // 入力
        string inp = Console.ReadLine();

        Regex rgxZO = new Regex("(01|10)");

        string tmp = inp;
        string old = string.Empty;
        while (true)
        {
            tmp = rgxZO.Replace(tmp, "");
            if (old == tmp)
            {
                break;
            }
            old = tmp;
        }
        ans = inp.Length - tmp.Length;

        //出力
        Console.WriteLine(ans);
    }
}
