using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            IEnumerable<char> chars = Console.ReadLine();

            int count = 0;

            while (true)
            {
                var result = RemoveOne(chars);
                if (result.Item1 == false)
                {
                    break;
                }
                else
                {
                    count++;
                    chars = result.Item2;
                }
            }

            Console.WriteLine(count*2);
             
        }

        private static Tuple<bool,IEnumerable<char>> RemoveOne(IEnumerable<char> source)
        {
            int index = Enumerable.Zip(
                source, 
                source.Skip(1), 
                (x, y) => (x == '0' && y == '1') || (x == '1' && y == '0'))
                .FindIndex(x=>x);

            if (index == -1) return Tuple.Create(false, source);

            else return Tuple.Create(true,source.IndexWhere(x=>x!=index && x != index +1));
        }

    }

    public static class Extension
    {
        public static int FindIndex<T>(this IEnumerable<T> source, Predicate<T> predicate)
      => (source.Select((data, index) => new { data, index }).FirstOrDefault(x=>predicate(x.data))?.index) ?? -1;

        public static IEnumerable<T> IndexWhere<T>(this IEnumerable<T> source, Predicate<int> indexPredicate)
        => source.Select((data, index) => new { data, index }).Where(x => indexPredicate(x.index)).Select(x=>x.data);
    }
}
