<?php
fscanf(STDIN, '%s', $s);
$_s = $s;
$pos = strpos($_s, '01');
if ($pos === false) $pos = strpos($_s, '10');
while ($pos !== false) {
    $_s = substr_replace($_s, '', $pos, 2);
    $pos = strpos($_s, '01');
    if ($pos === false) $pos = strpos($_s, '10');
}
$ans = strlen($s) - strlen($_s);
echo $ans . PHP_EOL;