use proconio::{fastout, input, marker::Chars};

#[fastout]
fn main() {
    input! {
        s: Chars
    };

    let mut s: Vec<char> = s;
    let mut count = 0;

    while s.iter().filter(|x| **x == '1').count() >= 1
        && s.iter().filter(|x| **x == '0').count() >= 1
    {
        let mut prev = s[0];
        let mut prev_i = 0;
        for i in 1..s.len() {
            if s[i] == '2' {
                continue;
            }
            if s[i] != prev && s[i] != '2' && prev != '2' {
                s[i] = '2';
                s[prev_i] = '2';
                count += 2;
                break;
            } else {
                prev = s[i];
                prev_i = i;
            }
        }
    }

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