class Program
{
    static int counter=0;
    static void circle(string temp)
    {
        string next = "";
        for (int i = 0; i < temp.Length; i++)
        {
            if (i < temp.Length - 1&&temp[i] != temp[i + 1])
            {
                counter += 2;
                i++;
            }
            else { next += temp[i]; }
        }
        if (next.Equals("") || temp.Equals(next)) {  }
        else { circle(next); }
    }

    static void Main(string[] args)
    {
        string temp = System.Console.ReadLine();
        circle(temp);
        System.Console.WriteLine(counter);
    }
}