#include <bits/stdc++.h>
using namespace std;
string s, s2, t1, t2;
int main() {
  long long n, l, r, i, j;
  cin >> s;
  n = s.length();
  char mx = 'a';
  for (i = n - 1; i >= 0; i--) {
    if (s[i] - mx >= 0) {
      mx = s[i];
      l = i;
    }
  }
  s2 += mx;
  r = l;
  for (i = mx - 'a'; i >= 0; i--) {
    char aa = 'a' + i;
    l = r;
    for (j = l + 1; j < n; j++) {
      if (s[j] == aa) {
        s2 += s[j];
        r = j;
      }
    }
  }
  cout << s2 << endl;
}
