#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int main() {
  string luv;
  cin >> luv;
  vector<int> patel[26];
  for (int i = 0; i < luv.length(); i++) patel[luv[i] - 'a'].push_back(i);
  int curr = -1;
  string answer;
  for (int i = 25; i >= 0; i--) {
    while (true) {
      vector<int>::iterator itr =
          upper_bound(patel[i].begin(), patel[i].end(), curr);
      if (itr == patel[i].end()) break;
      curr = *itr;
      answer += (i + 'a');
    }
  }
  cout << answer << endl;
  return 0;
}
