#include <bits/stdc++.h>
using namespace std;
bool myfunction(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first)
    return a.second < b.second;
  else
    return a.first > b.first;
}
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  int n = s.size();
  vector<pair<char, int> > v(n);
  for (int i = 0; i < n; i++) {
    v[i].first = s[i];
    v[i].second = i;
  }
  sort(v.begin(), v.end(), myfunction);
  int indx = v[0].second;
  for (int i = 0; i < n; i++) {
    if (v[i].second >= indx) {
      cout << v[i].first;
      indx = v[i].second;
    }
  }
  return 0;
}
