#include <bits/stdc++.h>
using namespace std;
vector<int> pos[30];
int main() {
  string str, ans;
  int len, i, j, last;
  last = -1;
  cin >> str;
  len = str.size();
  for (i = 0; i < len; i++) {
    pos[str[i] - 'a'].push_back(i);
  }
  ans = "";
  for (i = 30; i >= 0; i--) {
    len = pos[i].size();
    for (j = 0; j < len; j++) {
      if (pos[i][j] > last) {
        ans += (i + 'a');
        last = pos[i][j];
      }
    }
  }
  cout << ans << endl;
}
