#include <bits/stdc++.h>
using namespace std;
char s[100010];
char subs[100010];
char maxstr[100010];
int main() {
  cin >> s;
  int i, k = strlen(s);
  maxstr[k] = s[k];
  char maxletter = s[k];
  for (i = k - 1; i >= 0; i--) {
    if (maxletter < s[i]) maxletter = s[i];
    maxstr[i] = maxletter;
  }
  int j = 0;
  for (i = 0; i <= k; i++) {
    if (s[i] == maxstr[i]) {
      subs[j] = maxstr[i];
      j++;
    }
  }
  cout << subs << endl;
  return 0;
}
