#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  cin >> s;
  unordered_map<char, vector<long long int> > um;
  long long int i;
  for (i = 0; i < s.length(); i++) {
    um[s[i]].push_back(i);
  }
  long long int last = -1;
  bool flag;
  string ans = "";
  for (i = 25; i >= 0; i--) {
    char ch = 'a' + i;
    auto f = um.find(ch);
    if (f != um.end()) {
      for (auto it : um[ch]) {
        if (it > last) {
          ans += string(1, s[it]);
          flag = true;
        }
      }
      if (flag == true) last = um[ch][um[ch].size() - 1];
    }
    flag = false;
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
