use std::io::Read;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    
    let origin_len = s.len();
    loop {
        let prev_len = s.len();
        s = s.replace("10", "");
        s = s.replace("01", "");
        if prev_len == s.len() {
            println!("{}", origin_len - s.len());
            break;
        }
    }
}