#include <bits/stdc++.h>
using namespace std;
int cmp(const void* a, const void* b) { return *(int*)a - *(int*)b; }
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
char str[100005];
char ans[100005];
int dp[100005][30];
int main() {
  scanf("%s", str);
  memset(dp, 0, sizeof(dp));
  memset(ans, 0, sizeof(ans));
  int len = strlen(str);
  dp[0][str[0] - 'a'] = 1;
  for (int i = 1; i < len; i++) {
    int t = str[i] - 'a';
    int mx = -1;
    for (int j = t; j < 26; j++) {
      if (dp[i - 1][j] > mx) mx = dp[i - 1][j];
      dp[i][j] = dp[i - 1][j];
    }
    dp[i][t] = mx + 1;
  }
  int mlen = 0;
  for (int i = 'a'; i <= 'z'; i++) {
    if (dp[len - 1][i - 'a'] > mlen) mlen = dp[len - 1][i - 'a'];
  }
  ans[mlen] = '\0';
  int tlen = mlen;
  int pre = 'a';
  for (int i = len - 1; i >= 0; i--) {
    for (int j = 'z'; j >= pre; j--) {
      if (dp[i][j - 'a'] == tlen) {
        pre = j;
        tlen--;
        ans[tlen] = j;
      }
    }
  }
  printf("%s\n", ans);
  return 0;
}
