<?php

$s = str_split(trim(fgets(STDIN)));

$i = 0;
$c = 0;
while($i !== count($s)){
  
  if(isset($s[$i+1]) && $s[$i] !== $s[$i+1]){
    array_splice($s, $i, 2);
    $c += 2;
    if ($i > 0) $i--;
  } else {
    $i++;
  } 

  if ($i == count($s)) break;
}

echo $c;

  
?>