#include <bits/stdc++.h>
using namespace std;
int di[] = {0, 0, 1, -1};
int dj[] = {1, -1, 0, 0};
int main() {
  string s, ret;
  cin >> s;
  int idx = 0;
  for (int i = (int)s.size() - 1; i >= 0; i--) {
    if (idx <= s[i]) {
      ret += s[i];
      idx = s[i];
    }
  }
  reverse(ret.begin(), ret.end());
  cout << ret << endl;
  return 0;
}
