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 > cnt+1)
   {
       if( blockList[cnt] != blockList[cnt+1] )
       {
         removeBlock += 2;

         if( blockList.Count != 2 )
         {
           blockList.RemoveAt(cnt);           
           blockList.RemoveAt(cnt+1);
         }
         else
         {
           break;
         }

         cnt = 0;
       }
       else
       {
         cnt++;
       }
     
     Console.WriteLine(cnt);
   }

   Console.WriteLine(removeBlock);
 }
}