#include <bits/stdc++.h>
using namespace std;
string s;
char stevensaho[100100];
int len;
void update(char cur) {
  while (stevensaho[len - 1] < cur) {
    len--;
  }
  stevensaho[len] = cur;
  len++;
}
int main() {
  cin >> s;
  stevensaho[0] = 'z' + 1;
  len = 1;
  for (int i = 0; i < (int)s.length(); i++) {
    update(s[i]);
  }
  for (int i = 1; i < len; i++) {
    cout << stevensaho[i];
  }
  cout << "\n";
  return 0;
}
