#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a;
  int i = 0;
  int t = 0;
  for (char c = 'z'; c >= 'a'; c--) {
    i = t;
    for (; i < a.size(); i++) {
      if (a[i] == c) {
        b = b + c;
        t = i;
      }
    }
  }
  cout << b;
}
