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

fn main() {
    let mut s: Vec<u8> = read::<String>().as_bytes().to_vec();
    let mut flag = true;

    let mut ans = 0;

    while flag {
        flag = false;
        for i in (1..s.len()).rev() {
            if s[i] != s[i - 1] {
                s.remove(i);
                s.remove(i - 1);
                flag = true;
                ans += 2;
                break;
            }
        }
    }

    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()
}
