#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); }
long long power(long long a, long long n) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
int main() {
  ios_base::sync_with_stdio(false);
  int l = 0;
  string s;
  cin >> s;
  for (int(ch) = ('z'); (ch) >= ('a'); (ch)--) {
    for (int(i) = (l); (i) <= (s.size() - 1); (i)++) {
      if (s[i] == ch) {
        cout << char(ch);
        l = i;
      }
    }
  }
  return 0;
}
