#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<utility>
#include<set>
#include<bitset>
#include<vector>
#include<functional>
#include<deque>
#include<cctype>
#include<climits>
#include<complex>
#include<bits/stdc++.h>
#include<ctime>
 
using namespace std;
 
typedef long long LL;
typedef double DB;
typedef pair<int,int> PII;
typedef pair<DB,DB> PDD;
typedef complex<DB> CP;
typedef vector<int> VI;
 
#define mmst(a,v) memset(a,v,sizeof(a))
#define mmcy(a,b) memcpy(a,b,sizeof(a))
#define fill(a,l,r,v) fill(a+l,a+r+1,v)
#define re(i,a,b)  for(i=(a);i<=(b);i++)
#define red(i,a,b) for(i=(a);i>=(b);i--)
#define fi first
#define se second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define two(k) (1<<(k))
#define SZ(x) (int(x.size()))
#define all(x) (x).begin(),(x).end()
#define ire(i,v,x) for(i=0,v=i<SZ(x)?x[i]:0;i<SZ(x);v=x[++i])
#define ls (rt<<1)
#define rs (rt<<1|1)
#define MID ((l+r)>>1)
 
template<class T>inline T sqr(T x){return x*x;}
template<class T>inline void upmin(T &t,T tmp){if(t>tmp)t=tmp;}
template<class T>inline void upmax(T &t,T tmp){if(t<tmp)t=tmp;}
 
inline int sgn(DB x){if(fabs(x)<1e-9)return 0;return(x>0)?1:-1;}
const DB Pi=acos(-1.0);
 
int gint()
  {
		int res=0;bool neg=0;char z;
		for(z=getchar();z!=EOF && z!='-' && !isdigit(z);z=getchar());
		if(z==EOF)return 0;
		if(z=='-'){neg=1;z=getchar();}
		for(;z!=EOF && isdigit(z);res=(res<<3)+(res<<1)+z-'0',z=getchar());
		return (neg)?-res:res;
	}
LL gll()
  {
  	LL res=0;bool neg=0;char z;
		for(z=getchar();z!=EOF && z!='-' && !isdigit(z);z=getchar());
		if(z==EOF)return 0;
		if(z=='-'){neg=1;z=getchar();}
		for(;z!=EOF && isdigit(z);res=res*10+z-'0',z=getchar());
		return (neg)?-res:res;
	}
int gdb()
  {
  	string s;
  	cin>>s;
  	size_t p=s.find('.');
  	if(p==string::npos)
  	  s+="000";
  	else
  	  {
  	  	int d=s.length()-p-1;
  	  	s=s.substr(0,p)+s.substr(p+1);
  	  	while(d<3)s+="0",d++;
  	  }
  	istringstream is(s);
  	int res=0;
  	is>>res;
  	return res;
	}
 
const int maxn=210000;
 
int n;
char s[maxn];
int ch[maxn][26];
int tab[26];
int info[maxn],now;
struct Tedge{int v,next;}edge[26*maxn];
int d[maxn];

void add(int u,int v)
  {
  	edge[++now]=(Tedge){v,info[u]};info[u]=now;
  }

queue<int>que;
int vis[maxn];
void spfa(int S)
  {
  	mmst(d,0x3f);
  	que.push(S);
  	d[S]=0;
  	vis[S]=1;
  	while(!que.empty())
  	  {
  	  	int u=que.front(),i,v;que.pop();
  	  	vis[u]=0;
  	  	for(i=info[u],v=edge[i].v;i!=-1;i=edge[i].next,v=edge[i].v)
  	  	  if(d[u]+1<d[v])
  	  	    {
  	  	    	d[v]=d[u]+1;
  	  	    	if(!vis[v])vis[v]=1,que.push(v);
  	  	    }
  	  }
  }

int main()
  {
  	/*freopen("E.in","r",stdin);
  	freopen("E.out","w",stdout);*/
  	int i,j;
  	scanf("%s",s+1);
  	n=strlen(s+1);
  	mmst(info,-1);now=-1;
  	re(i,0,25)tab[i]=n+1;
		red(i,n,0)
		  {
		  	memcpy(ch[i],tab,sizeof(tab));
		  	if(i)tab[s[i]-'a']=i;
		  	re(j,0,25)add(ch[i][j],i);
		  }
		spfa(n+1);
		int u=0;
		while(u!=n+1)
		  {
		  	re(i,0,25)
		  	  {
		  	  	int v=ch[u][i];
		  	  	if(d[u]==d[v]+1){u=v;putchar('a'+i);break;}
		  	  }
		  }
		return 0;
	}

Measured memory_bytes: 66560