#include <bits/stdc++.h>
using namespace std;
struct e {
  char c;
  int idx;
} S[100009];
bool operator<(e a, e b) {
  if (a.c > b.c)
    return true;
  else if (b.c > a.c)
    return false;
  else {
    if (a.idx < b.idx)
      return true;
    else
      return false;
  }
}
string s;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    S[i].c = s[i];
    S[i].idx = i;
  }
  int n = s.size();
  sort(S, S + n);
  int curr = -1;
  string ans;
  for (int i = 0; i < n; i++) {
    if (S[i].idx > curr) {
      ans += S[i].c;
      curr = S[i].idx;
    }
  }
  cout << ans << endl;
}
