using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine();
        var l = new LinkedList<bool>(s.Select(x => x == '1'));
        var node = l.First;
        while (node == null || node.Next == null)
        {
            var nPrev = node;
            var nNext = node.Next;
            if (nPrev.Value != nNext.Value)
            {
                node = nPrev.Previous ?? nNext.Next;
                l.Remove(nPrev);
                l.Remove(nNext);
            }
            else
            {
                node = nNext;
            }
        }
        Console.WriteLine(s.Length - l.Count);
    }
}