#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
int a, b, c, d, i, j, n, m, k;
char str[100002];
int nx[52][100002];
inline int num(char ch) {
  if (ch >= 'A' && ch <= 'Z')
    return ch - 'A';
  else
    return ch - 'a' + 26;
}
int main() {
  scanf("%s", str);
  n = (int)strlen(str);
  memset(nx, -1, sizeof(nx));
  for (int _n((52) - 1), h(0); h <= _n; h++) {
    for (int i = (n - 1), _b = (0); i >= _b; i--) {
      if (num(str[i]) == h)
        nx[h][i] = i;
      else
        nx[h][i] = nx[h][i + 1];
    }
  }
  string ans;
  a = 0;
  while (a < n) {
    int mn = 1000000000;
    for (int cur = (51), _b = (0); cur >= _b; cur--) {
      if (nx[cur][a] != -1) {
        mn = nx[cur][a];
        break;
      }
    }
    ans += str[mn];
    a = mn + 1;
  }
  printf("%s\n", ans.c_str());
}
