using System;
class Program
{
	static void Main(string[] args)
	{
		// 文字列の入力
		string before = Console.ReadLine();
        int cnt = 0;
        string after;
        int sa;
        int len = before.Length;
        while(len>1){
            after = before.Replace("10","");
            after = after.Replace("01","");
            sa = before.Length - after.Length;
            if(sa==0){
                break;
            }else{
                cnt = cnt + sa;
                before = after;
                len = before.Length;
            }
        }
		//出力
		Console.WriteLine(cnt);
	}
}
