#include <bits/stdc++.h>
using namespace std;
void solve() {
  string str;
  cin >> str;
  string res;
  char c = 'z';
  int lastInd = 0;
  bool fnd = 0;
  for (c; c >= 'a'; c--) {
    fnd = 0;
    int latest = lastInd;
    for (lastInd + 1; lastInd < str.size(); lastInd++) {
      if (str[lastInd] == c) {
        res.push_back(c);
        latest = lastInd;
        fnd = 1;
      }
    }
    lastInd = latest;
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(9);
  solve();
  return 0;
}
