fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let s = sc
        .read::<String>()
        .chars()
        .map(|c| c as usize - 'a' as usize)
        .collect::<Vec<_>>();
    let n = s.len();
    let mut seg_id = vec![0; n];
    let mut cur = 0;
    let mut mask = 0;
    for i in (0..n).rev() {
        mask |= 1 << s[i];
        seg_id[i] = cur;
        if mask == (1 << 26) - 1 {
            mask = 0;
            cur += 1;
        }
    }

    let mut index = vec![vec![]; 26];
    for i in 0..n {
        index[s[i]].push(i);
    }

    for i in 0..26 {
        index[i].reverse();
    }

    let mut cur_pos = 0;
    let mut ans = vec![];
    if mask == 0 {
        match index[0].pop() {
            Some(pos) => {
                ans.push(0);
                cur_pos = pos;
            }
            None => {
                println!("a");
                return;
            }
        }
    } else {
        for i in 0..26 {
            if mask & (1 << i) != 0 {
                continue;
            }
            match index[i].pop() {
                Some(pos) => {
                    ans.push(i);
                    cur_pos = pos;
                    break;
                }
                None => {
                    println!("{}", (i as u8 + 'a' as u8) as char);
                    return;
                }
            }
        }
    }

    loop {
        for i in 0..26 {
            while let Some(pos) = index[i].pop() {
                if pos > cur_pos {
                    index[i].push(pos);
                    break;
                }
            }
        }

        for next in 0..26 {
            match index[next].pop() {
                Some(pos) => {
                    if seg_id[cur_pos] != seg_id[pos] {
                        ans.push(next);
                        cur_pos = pos;
                        break;
                    } else {
                        index[next].push(pos);
                    }
                }
                None => {
                    ans.push(next);
                    for ans in ans.into_iter() {
                        sc.write(format!("{}", (ans as u8 + 'a' as u8) as char));
                    }
                    sc.write("\n");
                    return;
                }
            }
        }
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 10492