#include <bits/stdc++.h>
using namespace std;
char s[100005];
int b[27];
string ss;
int main() {
  scanf("%s", s);
  int l = strlen(s);
  memset(b, 0, sizeof(b));
  for (int i = 0; i < l; i++) {
    b[s[i] - 'a']++;
  }
  int j = 0;
  for (int i = 25; i >= 0; i--) {
    while (b[i] && j < l) {
      if (i == (s[j] - 'a')) {
        b[i]--;
        ss += s[j];
      }
      if (j < l) j++;
    }
    if (!b[i] && b[i - 1]) {
      b[i - 1] = 0;
      for (int k = j; k < l; k++)
        if (s[k] - 'a' == i - 1) b[i - 1]++;
    }
  }
  cout << ss << endl;
}
