#include <bits/stdc++.h>
using namespace std;
int used[35], q, l, t, d;
int main() {
  char a[200000], z;
  cin.getline(a, 200000);
  d = strlen(a);
  for (int i = 0; i < d; i++) {
    used[a[i] - 'a']++;
  }
  for (int i = 26; i >= 0; i--) {
    z = i + 'a';
    while (used[i] > 0) {
      if (q >= d) break;
      if (a[q] == z) {
        cout << z;
        t = q;
      }
      if (used[a[q] - 'a'] > 0) used[a[q] - 'a']--;
      q++;
    }
    q = t;
  }
  cout << endl;
  return 0;
}
