#include <bits/stdc++.h>
using namespace std;
struct Event {
  char r;
  int pos;
  Event(char r = ' ', int pos = -1) : r(r), pos(pos) {}
};
bool operator<(Event a, Event b) {
  if (a.r != b.r) return a.r > b.r;
  return a.pos < b.pos;
}
vector<Event> v;
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < int(s.length()); i++) v.push_back(Event(s[i], i));
  sort(v.begin(), v.end());
  vector<Event> ans;
  for (int i = 0; i < int(v.size()); i++)
    if (ans.size() == 0 || (ans[int(ans.size()) - 1].pos < v[i].pos))
      ans.push_back(v[i]);
  for (int i = 0; i < int(ans.size()); i++) cout << ans[i].r;
  cout << endl;
  return 0;
}
