use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let s: Vec<char> = read::<String>().chars().collect();

    let mut ans = 0;
    let mut last = ' ';
    let mut flag = false;
    let mut i = 0;

    while i < s.len() {
        if i < s.len() - 1 {
            if s[i] == '0' && s[i + 1] == '1' || s[i] == '1' && s[i + 1] == '0' {
                flag = true;
                i += 2;
                ans += 2;
                continue;
            }
        } else if flag && last != s[i] {
            flag = true;
            ans += 2;
            i += 1;
            continue;
        }
        flag = false;
        last = s[i];
        i += 1;
    }

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}
