#include <bits/stdc++.h>
using namespace std;
vector<string> vs, vs2;
set<string> st;
map<string, int> mp, mp1;
long long i, j, k, x, y, m, n, a, b, c, d, e, f, g, h, l, o, p, q, t, u, v, w,
    z, r, ln, neg, pos, sm, ar[500000 + 5], br[500000 + 5], fr[60], cnt;
string s, s1, s2, s3;
int main() {
  while (getline(cin, s)) {
    ln = s.size();
    long long in = 0;
    for (int i = 'z'; i >= 'a'; i--) {
      for (j = in; j < ln; j++) {
        if (i == (int)s[j]) {
          in = max(in, j);
          cout << s[j];
        }
      }
    }
    cout << endl;
  }
  return 0;
}
