#include <bits/stdc++.h>
using namespace std;
char s[100005];
int poz[100005];
bool cmp(int a, int b) {
  if (s[a] == s[b]) return a < b;
  return s[a] > s[b];
}
int main() {
  cin >> s;
  int i = strlen(s);
  for (int j = 0; j < i; j++) poz[j] = j;
  sort(poz, poz + i, cmp);
  string rez;
  rez += s[poz[0]];
  int temp = 0;
  for (int j = 1; j < i; j++) {
    if (poz[j] < poz[temp]) {
      continue;
    }
    temp = j;
    rez += s[poz[j]];
  }
  cout << rez << "\n";
}
