using System;

public class Program
{
    static void Main()
    {
        var str = Console.ReadLine();
        var count = 0;
        for (int i = 0; i < str.Length - 1; i++)
        {
            if (str[i] != str[i + 1])
            {
                str = str.Remove(i, 2);
                count++;
                i = -1;
            }
        }

        Console.WriteLine(count * 2);
    }
}