#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int prime = 9241;
const long double pi = acos(-1.);
int main() {
  string s;
  cin >> s;
  int n = s.length();
  vector<int> ms(n);
  ms[n - 1] = n - 1;
  for (int i = n - 2; i >= 0; i--)
    if (s[ms[i + 1]] > s[i])
      ms[i] = ms[i + 1];
    else
      ms[i] = i;
  for (int j = ms[0]; j < n;) {
    cout << s[j];
    if (j == n - 1) break;
    j = ms[j + 1];
  }
  cout << endl;
}
