#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double eps = 1e-10;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const double pi = acos(-1.0);
const int MAX_INT = (1 << 30);
const ll MAX_LL = (1LL << 62);
int lastIndex[26];
int main() {
  memset(lastIndex, -1, sizeof(lastIndex));
  string s;
  cin >> s;
  for (int i = 0; i < (int)s.size(); i++) lastIndex[s[i] - 'a'] = i;
  int perv = 0;
  string res = "";
  for (int i = 25; i >= 0; i--) {
    if (lastIndex[i] >= perv) {
      for (; perv <= lastIndex[i]; perv++) {
        if (s[perv] - 'a' == i) res += s[perv];
      }
    }
  }
  cout << res << endl;
  return 0;
}
