#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, i, j;
  string s;
  char ans[100001], ans1[100001];
  int count = 0;
  int mxc[100001];
  cin >> s;
  char ch = 'a';
  for (i = s.size() - 1; i >= 0; i--) {
    if (ch <= s[i]) {
      ans[count++] = s[i];
      ch = s[i];
    }
  }
  for (i = count - 1; i >= 0; i--) {
    cout << ans[i];
  }
  return 0;
}
