<?php
$stdin = trim(fgets(STDIN));
for ($i = 0; $i < strlen($stdin); ++$i) {
    $arr[] = substr($stdin, $i, 1);
}

$cnt = 0;
$stack = [];

foreach ($arr as $k => $v) {
    if (isset($stack[0])) {
        if ($v != $stack[0]) {
            $cnt = $cnt + 2;
            array_shift($stack);
        } else {
            array_unshift($stack, $v);
        }
    } else {
        array_unshift($stack, $v);
    }
}

echo $cnt;