#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
char s[N];
int maxC[N];
int pos[N];
int n;
int main() {
  cin >> s;
  n = strlen(s);
  maxC[n - 1] = s[n - 1];
  pos[n - 1] = n - 1;
  pos[n] = n;
  for (int i = n - 2; i >= 0; --i) {
    if (maxC[i + 1] <= s[i]) {
      maxC[i] = s[i];
      pos[i] = i;
    } else {
      maxC[i] = maxC[i + 1];
      pos[i] = pos[i + 1];
    }
  }
  for (int i = pos[0]; i < n; i = pos[i + 1]) cout << s[i];
  return 0;
}
