fn get_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().to_string()
}

use std::collections::HashMap;

fn main() {
    let xs: Vec<char> = get_line().chars().collect();

    let mut bs = vec![1; xs.len() + 1];
    let mut cs = vec![1; xs.len() + 1];

    let mut hbs: HashMap<char, u64> = HashMap::new();
    for (i, x) in xs.iter().enumerate() {
        if hbs.contains_key(x) {
            *hbs.get_mut(x).unwrap() += 1;
        }
        else {
            hbs.insert(*x, 1);
        }

        let mut o = false;
        let mut f = true;
        for &v in hbs.values() {
            if !o && v % 2 == 1 {
                o = true;
            }
            else if o && v % 2 == 1 {
                f = false;
                break;
            }
        }

        if !f {
            bs[i + 1] = bs[i] + 1;
        }
    }
    bs[0] = 0;

    hbs.clear();
    for i in 0..xs.len() {
        let i = xs.len() - i - 1;

        if hbs.contains_key(&xs[i]) {
            *hbs.get_mut(&xs[i]).unwrap() += 1;
        }
        else {
            hbs.insert(xs[i], 1);
        }

        let mut o = false;
        let mut f = true;
        for &v in hbs.values() {
            if !o && v % 2 == 1 {
                o = true;
            }
            else if o && v % 2 == 1 {
                f = false;
                break;
            }
        }

        if !f {
            cs[i] = cs[i + 1] + 1;
        }
    }
    cs[xs.len()] = 0;

    let mut res = xs.len() as u64;
    for i in 0..(xs.len() + 1) {
        if res > bs[i] + cs[i] {
            res = bs[i] + cs[i];
        }
    }

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