#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  map<char, long long int> z;
  set<char> aa;
  vector<char> a;
  for (long long int i = 0; i < s.size(); i++) {
    z[s[i]] = i;
    aa.insert(s[i]);
  }
  for (auto x : aa) {
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  long long int j = 0;
  string ans;
  for (long long int i = 0; i < s.size();) {
    if (z[a[j]] >= i) {
      if (a[j] == s[i]) {
        ans += s[i];
      }
      i++;
    } else {
      j++;
    }
  }
  cout << ans << endl;
  return 0;
}
