import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

data class V(val len: Int, val c: Char, var next: V?)

fun solve() {
    val a = inf.readLine()!!.toCharArray()
    val z = Array<V?>(26) { null }
    for (i in a.indices.reversed()) {
        val c = a[i]
        var cn = z.indexOfFirst { it == null }
        if (cn == -1) {
            val mx = z.minBy { it!!.len }!!.len
            cn = z.indexOfFirst { it!!.len == mx }
        }
        val v = z[cn]
        z[c - 'a'] = V((v?.len ?: 0) + 1, ('a' + cn), v)
    }
    var cn = z.indexOfFirst { it == null }
    if (cn == -1) {
        val mx = z.minBy { it!!.len }!!.len
        cn = z.indexOfFirst { it!!.len == mx }
    }
    var v = z[cn]
    if (v == null) {
        println('a' + cn)
    } else {
        print('a' + cn)
        while (v != null) {
            print(v.c)
            v = v.next
        }
    }
}

fun main(args: Array<String>) {
    solve()
    ouf.close()
}

val inf = BufferedReader(InputStreamReader(System.`in`))
val ouf = PrintWriter(System.out)