<?php

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

$count = 0;
$flag = true;

while ($flag) {
    $flag = false;
    $tmp_count_a = 0;
    $tmp_count_b = 0;
    
    if (strpos($S, '10') !== false) {
        $tmp_s_a = str_replace('10', '', $S);
        $tmp_count_a += 2;
        $flag = true;
    }

    if (strpos($S, '01') !== false) {
        $tmp_s_a = str_replace('01', '', $S);
        $tmp_count_a += 2;
        $flag = true;
    }

    if (strpos($S, '01') !== false) {
        $tmp_s_b = str_replace('01', '', $S);
        $tmp_count_b += 2;
        $flag = true;
    }

    if (strpos($S, '10') !== false) {
        $tmp_s_b = str_replace('10', '', $S);
        $tmp_count_b += 2;
        $flag = true;
    }
    
    if ($tmp_count_a > $tmp_count_b) {
        $S = $tmp_s_a;
        $count += $tmp_count_a;
    } else {
        $S = $tmp_s_b;
        $count += $tmp_count_b;
    }
}

echo $count;
