#include <bits/stdc++.h>
using namespace std;
string s;
vector<pair<char, int> > ss;
bool cmp(pair<char, int> x, pair<char, int> y) {
  if (x.first == y.first)
    return x.second < y.second;
  else
    return x.first > y.first;
}
int main() {
  while (cin >> s) {
    ss.clear();
    for (int i = 0; i < s.length(); i++) ss.push_back(make_pair(s[i], i));
    sort(ss.begin(), ss.end(), cmp);
    int cur = -1;
    for (int i = 0; i < ss.size(); i++)
      if (ss[i].second > cur) {
        printf("%c", ss[i].first);
        cur = ss[i].second;
      }
    puts("");
  }
  return 0;
}
