#include <bits/stdc++.h>
using namespace std;
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.second > b.second) {
    return true;
  } else if (a.second == b.second && a.first < b.first) {
    return true;
  } else {
    return false;
  }
}
int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  std::vector<pair<int, int> > v;
  for (int i = 0; i < s.size(); ++i) {
    v.push_back(make_pair(i, s[i] - 'a'));
  }
  sort(v.begin(), v.end(), cmp);
  string str;
  int lastscene = v[0].first;
  str += (v[0].second + 'a');
  for (int i = 1; i < v.size(); ++i) {
    if (v[i].first > lastscene) {
      lastscene = v[i].first;
      str += (v[i].second + 'a');
    }
  }
  cout << str << endl;
  return 0;
}
