<?php

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

$count = 0;
$flag = true;

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

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

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

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

if (strpos($S, '10') !== false) {
    $S = str_replace('10', '', $S);
    $count += 2;
}

if (strpos($S, '01') !== false) {
    $S = str_replace('01', '', $S);
    $count += 2;
}

echo $count;
