#include<cstdio>
#include<cstring> 
#define N 200010
 
using namespace std;

int n;
int a[27], f[N], g[N], dp[N];
char s[N];

int main(){
	int t, i, j;
    scanf("%s", s + 1);
    n = strlen(s + 1);
    f[n+1] = n + 2; g[n+1] = 1;
    dp[n+1]=1;
    for(i = 1; i <= 26; ++i) a[i]=n+1;
    for(i = n; i >= 1; --i){
        a[s[i]-'a'+1] = i;
        t = 1;
        for(j = 2; j <= 26; ++j)
        if (dp[a[j]+1] < dp[a[t]+1]) t = j;
        dp[i] = dp[a[t]+1] + 1;
        f[i] = a[t]; g[i] = t;
    }
    for(i = 1; i <= n+1; i = f[i] + 1)
		putchar(g[i]+'a'-1);
    return 0;
}