#include <bits/stdc++.h>
using namespace std;
struct node {
  char c;
  int index;
};
struct node nodes[100000];
bool mycmp(struct node i, struct node j) { return (i.c > j.c); }
int main() {
  char c;
  int i = 0;
  while (cin >> c) {
    nodes[i].c = c;
    nodes[i].index = i;
    i++;
  }
  stable_sort(nodes, nodes + i, mycmp);
  int flag = -1;
  for (int j = 0; j < i; j++) {
    if (nodes[j].index > flag) {
      cout << nodes[j].c;
      flag = nodes[j].index;
    }
  }
  cout << endl;
  return 0;
}
