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

public class Program
{
    static void Main()
    {
        var vals = Console.ReadLine().Select(x => int.Parse(x.ToString())).ToList();
        var count = 0;
        while (true)
        {
            var removeIndex = new List<int>();
            for (int i = 0; i < vals.Count - 1; i++)
            {
                if (vals[i] != vals[i + 1])
                {
                    removeIndex.Add(i);
                    i++;
                }
            }

            if (removeIndex.Count == 0)
            {
                break;
            }

            removeIndex.Reverse();
            foreach (var i in removeIndex)
            {
                vals.RemoveRange(i, 2);
            }

            count += removeIndex.Count;
        }

        Console.WriteLine(count * 2);
    }
}