<?php
$stdin = trim(fgets(STDIN));
$numbers = str_split($stdin, 1);

$count = 0;
do {
    $lastValue = $lastKey = -1;
    $found = false;
    foreach ($numbers as $key => $num) {
        if (-1 == $lastValue) {
            $lastValue = $num;
            $lastKey = $key;
            continue;
        }

        if ($num != $lastValue) {
            $count = $count + 2;
            unset($numbers[$lastKey]);
            unset($numbers[$key]);
            $lastValue = $lastKey = -1;
            $found = true;
        }
    }
} while ($found);

print($count);