using System;
using System.Collections;
using System.Collections.Generic;

class Program
{
 static void Main( string[] args )
 {
   int[] num = new int[3];
   int loopNum = 0;
   int cnt =0;
   int removeBlock = 0;
   var blockList = new List<char>();
   
   String str = Console.ReadLine();
   char[] chArray = str.ToCharArray();
   
   blockList.AddRange(chArray);
   
   while((blockList.Count - 1) > cnt)
   {
     if(　(blockList.Count - 1)　> 1　)
     {
       if( blockList[cnt] != blockList[cnt+1] )
       {
         removeBlock += 2;

         blockList.RemoveAt(cnt);
         blockList.RemoveAt(cnt+1);

         cnt = 0;
       }
       else
       {
         cnt++;
       }
     }
     else
     {
      break; 
     }
   }

   Console.WriteLine(removeBlock);
 }
}