#include <bits/stdc++.h>

using namespace std;

const int INF = 1e9;

int n,i,dp[200055],to[200055],j;
char s[200055];
stack <int> pos[26];

int main(){
	scanf("%s", s + 1);
	
	n = strlen(s + 1);
	
	for(i = n + 1; i <= n + 26; i++)
	s[i] = 'a' + i - 1 - n;
	
	for(i = 0; i < 26; i++)
	pos[i].push(n + i + 1);
	
	for(i = n; i >= 0; i--){
		int mn = INF;
		int ind = -1;
		
		for(j = 0; j < 26; j++){
			if(dp[pos[j].top()] < mn){
				mn = dp[pos[j].top()];
				ind = pos[j].top();
			}
		}
		
		dp[i] = mn + 1;
		to[i] = ind;
		
		if(i != 0)
		pos[s[i] - 'a'].push(i);
	}
	
	int now = 0;
	
	while(now <= n){
		now = to[now];
		printf("%c", s[now]);
	}
	
	printf("\n");
}
