#include <bits/stdc++.h>
using namespace std;
const int maxl = 1000 * 100 + 5;
int mx[maxl];
string s;
int main() {
  cin >> s;
  reverse(s.begin(), s.end());
  mx[0] = -1;
  for (int i = 1; i < s.size(); i++)
    if (s[mx[i]] <= s[i])
      mx[i + 1] = i;
    else
      mx[i + 1] = mx[i];
  int ind = mx[s.size()];
  while (ind != -1) {
    cout << s[ind];
    ind = mx[ind];
  }
  cout << endl;
}
