#include<deque>
#include<stdint.h>
#include<set>
#include<stack>
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<map>
using namespace std;
int n,m,i,j,dp[200005],ls[30],pre[200005],mx;
char as[200005];
string st;
void print(int x)
{
	cout<<as[x];
	if (pre[x]<st.size()) print(pre[x]+1);
}
int main()
{
	cin>>st;
	for (i=1;i<=26;i++) ls[i]=st.size();
	dp[st.size()]=1;
	pre[st.size()]=st.size()+1;
	for (i=st.size();i>=0;i--)
	{
		ls[st[i]-'a'+1]=i;
		mx=1;
		for (j=2;j<=26;j++) if (dp[ls[j]+1]<dp[ls[mx]+1]) mx=j;
		dp[i]=dp[ls[mx]+1]+1;pre[i]=ls[mx];as[i]=mx+'a'-1;
	}
	print(0);
	return 0;
}