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

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Solve(string S)
        {
            int count = 0;
            for (int i = 0; i + 1 < S.Length; ++i)
            {
                if (S[i] != S[i + 1])
                {
                    S = S.Substring(0, i) + S.Substring(i + 2);
                    count += 2;
                    i = Math.Max(i - 2, -1);
                }
            }
            return count;
        }

        static void Main(string[] args)
        {
            Console.WriteLine(Solve(Read()));
        }
    }
}
