#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  string s, c;
  cin >> s;
  long long int l = s.length(), i, j = 1;
  c += s[l - 1];
  for (i = l - 2; i >= 0; i--) {
    if (s[i] >= c[j - 1]) {
      c += s[i];
      j++;
    }
  }
  reverse(c.begin(), c.end());
  cout << c;
}
