#include<bits/stdc++.h>
    using namespace std;
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    template <typename T>
    using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

    #define LOCAL 0

    #define length(a) (sizeof(a)/sizeof(a[0]))
    #define print(v,i,x) for(int j=i;j<=x;j++){cout<<v[j]<<" ";}cout<<endl;
    #define pb push_back
    #define mp make_pair
    #define lli long long int
    #define ulli unsigned long long int
    #define all(x) x.begin(),x.end()
    #define f first
    #define s second

    #define si(x) scanf("%d",&x)
    #define sli(x) scanf("%ld",&x)
    #define slli(x) scanf("%lld",&x)
    #define si2(x,y) {si(x);si(y);}
    #define si3(x,y,z) {si(x);si(y);si(z);}
    #define slli2(x,y) {slli(x);slli(y);}
    #define slli3(x,y,z) {slli(x);slli(y);slli(z);}

    #define pi(x) printf("%d",x)
    #define pi2(x,y) printf("%d %d",x,y)
    #define pi3(x,y,z) printf("%d %d %d",x,y,z)
    #define pli(x) printf("%ld",x)
    #define plli(x) printf("%lld",x)
    #define plli2(x,y) printf("%lld %lld",x,y)
    #define plli3(x,y,z) printf("%lld %lld %lld",x,y,z)
    #define pn printf("\n")
    #define ps printf(" ")
    #define pc(c) printf("%c",c)
    #define pstr(s) printf("%s",s)

    #define FOR(i,x,n) for(int i=x;i<=n;i++)
    #define FORl(i,x,n) for(lli i=x;i<=n;i++)
    #define ROF(i,x,n) for(int i=x;i>=n;i--)
    #define ROFl(i,x,n) for(lli i=x;i>=n;i--)

    #define debug(x) cout << "  - " << #x << ": " << x << endl;
    #define debugs(x, y) cout << "  - " << #x << ": " << x << "         " << #y << ": " << y << endl;
    #define debugss(x, y, z) cout << "  - " << #x << ": " << x << "         " << #y << ": " << y << "         " << #z << ": " << z <<  endl;
    #define fastIO 	std::ios::sync_with_stdio(false);cin.tie(NULL);
    #define cut cout<<"------------------------------------------\n";
    #define cut1 cout<<"******************************************\n";

    typedef vector<int> vi;
    typedef vector<long long> vlli;
    typedef vector<string> vstr;

    typedef pair<int,int> prii;
    typedef pair<int,lli> prilli;
    typedef pair<lli,int> prllii;
    typedef pair<lli,lli> prllilli;

    const lli mod = 1000000007ll;
    const lli MOD = 1000000009ll;
    const lli INF = LLONG_MAX/10;
    const int inf = INT_MAX/2;

    lli count_bit(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
    lli check_bit(lli _mask,lli _i){lli x=1;return (_mask&(x<<_i))==0?0:1;}
    lli set_bit(lli _mask,lli _i){lli x=1;_mask=_mask|(x<<_i);return _mask;}
    lli highest_bit(lli _mask){lli ret=-1;int cnt=0;while(_mask){if(_mask&1)ret=cnt;_mask/=2;cnt++;}return ret;}
    lli powermod(lli _a,lli _b,lli _m=mod){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
    lli power(lli _a,lli _b){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
    lli add(lli a,lli b,lli m=mod){lli x=a+b;while(x>=m)x-=m;return x;}
    lli sub(lli a,lli b,lli m=mod){lli x=a-b;while(x<0)x+=m;return x;}
    lli mul(lli a,lli b,lli m=mod){lli x=a*b;x%=m;return x;}
    lli gcd(lli a,lli b){while(a&&b)a>b?a%=b:b%=a;return a+b;}
    lli lcm(lli a,lli b){return (max(a,b)/gcd(a,b))*min(a,b);}


    struct cmp{
        bool operator()(int const & l,int const & r){
            return true;
        }
    }myobject;

    int cnt[200010],pos[200010][26],l[200010],r[200010],dp[200010];
    int n;
    string s;
    set<char> m;

    void fillPos(char c){
        FOR(i,0,n){
            int j=i+1;
            while(j<=n && s[j]!=c)j++;
            while(i<j){pos[i][c-'a']=j;i++;}
            i--;
        }
    }

    int main()
    {

        if(LOCAL){
            freopen("C:\\Users\\Smit Patel\\Downloads\\3.in","r",stdin);
            freopen("C:\\Users\\Smit Patel\\Downloads\\4.txt","w",stdout);
        }

        FOR(i,0,200009){
            cnt[i]=dp[i]=0;
            r[i]=n+1;
            fill(pos[i],pos[i]+26,-1);
        }

        cin>>s;
        n=s.size();
        s='-'+s;

        int nt=n;

        ROF(i,n,1){
            cnt[i]=m.size();
            m.insert(s[i]);
            if(cnt[i]<26)nt=i;
        }

        if(m.size()<26){
            m.insert('~');
            int i=0;
            for(auto c:m)if(c-'a'!=i){cout<<(char)(i+'a');return 0;} else i++;
        }

        FOR(i,0,25)fillPos((char)(i+'a'));

        FOR(i,nt,n){dp[i]=1;r[i]=n+1;}

        ROF(i,nt-1,1){
            int mx=-1,k=-1;
            FOR(j,0,25)
            mx=max(mx,pos[i][j]);
            if(mx<nt){
                dp[i]=inf;
                FOR(j,0,25){
                    if(dp[i]>1+dp[pos[i][j]]){
                        dp[i]=1+dp[pos[i][j]];
                        r[i]=pos[i][j];
                    }
                }
            }
            else{
                FOR(j,0,25)
                if(pos[i][j]>=nt){r[i]=pos[i][j];dp[i]=1+dp[pos[i][j]];break;}
            }
        }

        int idx=-1,sz=inf,c=inf;
        FOR(j,0,25)if(sz>dp[pos[0][j]] || (sz==dp[pos[0][j]] && c>j)){idx=pos[0][j];c=j;sz=dp[pos[0][j]];}

        string ans="";
        while(idx<=n){
            ans+=s[idx];
            if(r[idx]==n+1)break;
            idx=r[idx];
        }

        m.clear();
        ROF(i,n,idx+1)m.insert(s[i]);
        m.insert('~');
        int k=0;
        for(auto c:m){
            if(k!=c-'a')
                {ans+=(char)(k+'a');break;}
            else
                k++;
        }

        cout<<ans;

        return 0;
    }


Measured memory_bytes: 23684