<?php

fscanf(STDIN, '%s', $S);

$count = 0;
$flag = true;
while ($flag) {
    $flag = false;
    if (strpos($S, '10') !== false) {
        $count += 2 * substr_count($S, '10');
        $S = str_replace('10', '', $S);
        $flag = true;
    }
}

$flag = true;
while ($flag) {
    $flag = false;
    if (strpos($S, '01') !== false) {
        $count += 2 * substr_count($S, '01');
        $S = str_replace('01', '', $S);
        $flag = true;
    }
}

echo $count;
