#include <bits/stdc++.h>
using namespace std;
string a, b;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> a;
  b = "";
  int c = -1;
  int n = a.size();
  int l;
  for (int i = 25; i >= 0; i--) {
    stringstream ss;
    ss << (char)(i + 'a');
    string cur = ss.str();
    while ((l = a.find(cur, c + 1)) != string::npos) {
      b += cur;
      c = l;
    }
  }
  cout << b << endl;
  return 0;
}
