#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
} a[100005];
char str[100005];
inline bool cmp(const node &x, const node &y) {
  if (x.x != y.x) return x.x > y.x;
  return x.y < y.y;
}
int main() {
  while (scanf(" %s", str) != EOF) {
    int l = strlen(str);
    for (int i = 0; i < l; i++) {
      a[i].x = (int)str[i];
      a[i].y = i;
    }
    sort(a, a + l, cmp);
    int now = -1;
    for (int i = 0; i < l; i++) {
      if (a[i].y > now) {
        printf("%c", (char)a[i].x);
        now = a[i].y;
      }
    }
    printf("\n");
  }
  return 0;
}
