using System;
using System.Collections.Generic;
class Program
{
    //static List<string> str = new List<string>();
    static void Main(string[] args)
    {
        // 入力
        //string[] input = Console.ReadLine().Split(' ');
        string S = Console.ReadLine();
        int N = S.Length;

        while(true)
        {
            string tempS = S;
            S = S.Replace("01", "");
            S = S.Replace("10", "");

            if (tempS == S)
                break;
        }

        int ret = N - S.Length;
        Console.WriteLine(ret);
    }
}