#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define mod 1000000007
#define N 200010
using namespace std;
int ans[N], a[N], b[N];
char s[N];
int r[N][27], l[N][27];
int main()
{
    int i, j, n, t, cur, cnt, len;
    int now[27];
    scanf("%s", s + 1);
    len = strlen(s + 1);
    n = len / 2;
    for(i = 1; i <= n; ++i) swap(s[i], s[len - i + 1]);
    for(i = 1; i <= len; ++i) a[i] = s[i] - 'a' + 1;
    for(i = 1; i <= 26; ++i) now[i] = len + 1;
    for(i = len; i >= 0; --i)
    {
        for(j = 1; j <= 26; ++j)
            r[i][j] = now[j];
        now[a[i]] = i;
    }
    for(i = 1; i <= 26; ++i) now[i] = 0;
    for(i = 1; i <= len + 1; ++i)
    {
        for(j = 1; j <= 26; ++j)
            l[i][j] = now[j];
        now[a[i]] = i;
    }
    cur = cnt = 0;
    while(cur != len + 1)
    {
        b[++cnt] = cur;
        t = 0;
        for(i = 1; i <= 26; ++i)
            t = max(t, r[cur][i]);
        cur = t;
    }
    cur = len + 1;
    for(i = cnt; i >= 1; --i)
    {
        for(j = 1; j <= 26; ++j)
        {
            if(l[cur][j] <= b[i])
            {
                ans[cnt - i + 1] = j;
                cur = l[cur][j];
                break;
            }
        }
    }
    for(i = 1; i <= cnt; ++i)
        printf("%c", ans[i] + 'a' - 1);
    printf("\n");
    return 0;
}
/*
abcdefghijklmnopqrstuvwxyzab
*/
