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

$len = count($arr);
$cnt = 0;
$remove_num = null;

foreach ($arr as $k => $v) {
    if ($k > 0) {
        if ($remove_num !== null) {
            $before_key = ($k - $remove_num - 1);
        } else {
            $before_key = $k - 1;
        }

        if ($v != $arr[$before_key]) {
            $cnt = $cnt + 2;
            $remove_num = $k;
        } else {
            $remove_num = null;
        }
    }
}

echo $cnt;