#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
char res[MAXN];
int main() {
  string s;
  cin >> s;
  int it = 0;
  for (int i = (0); i < (int((s).size())); ++i) {
    if (!it) {
      res[it++] = s[i];
      continue;
    } else {
      while (it > 0 && res[it - 1] < s[i]) it--;
      res[it++] = s[i];
    }
  }
  for (int i = (0); i < (it); ++i) cout << res[i];
  cout << endl;
  return 0;
}
