#include <bits/stdc++.h>
using namespace std;
const int UNDEF = -1;
const int INF = 2000000000;
const long long INF64 = 4000000000000000000;
const double PI = 3.1415926535897932384626433832795;
const double EPS = 1e-9;
template <typename T>
T sqr(const T &x) {
  return x * x;
}
template <typename T>
const string GetString(const T &val) {
  ostringstream sout;
  sout << val;
  return sout.str();
}
int main() {
  const int SZ = 'z' - 'a' + 1;
  string s;
  cin >> s;
  vector<vector<int> > mas(SZ);
  for (int i = 0; i < (s.size()); ++i) {
    mas[s[i] - 'a'].push_back(i);
  }
  int last = -1;
  for (int i = (SZ)-1; i >= 0; --i) {
    int j = 0;
    while (j < mas[i].size() && mas[i][j] < last) ++j;
    for (; j < mas[i].size(); ++j) {
      cout << char(i + 'a');
      last = mas[i][j];
    }
  }
  cout << endl;
  return 0;
}
