#include <bits/stdc++.h>
char str[100005], ans[100005];
int out[100005];
struct Edge {
  int link[400005], next[400005], son[400005], l;
  void clear() {
    l = 0;
    memset(son, 0, sizeof(son));
  }
  void addedge(int x, int y) {
    link[++l] = y;
    next[l] = son[x];
    son[x] = l;
  }
};
Edge e;
int top = 0;
int main() {
  scanf("%s", str);
  int l = strlen(str);
  for (int i = l - 1; i >= 0; --i) e.addedge(str[i], i);
  for (char c = 'z'; c >= 'a'; --c)
    for (int p = e.son[c]; p; p = e.next[p])
      if (top == 0 || e.link[p] > out[top]) out[++top] = e.link[p];
  for (int i = 1; i <= top; ++i) ans[i - 1] = str[out[i]];
  printf("%s\n", ans);
  return 0;
}
