#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
bool vis[MAXN];
char str[MAXN];
int main() {
  gets(str);
  int len = strlen(str);
  char maxch = 0;
  memset(vis, false, sizeof(vis));
  for (int i = len - 1; i >= 0; i--) {
    if (str[i] >= maxch) vis[i] = true;
    maxch = max(maxch, str[i]);
  }
  for (int i = 0; i < len; i++) {
    if (vis[i]) putchar(str[i]);
  }
  puts("");
  return 0;
}
