#include <bits/stdc++.h>
using namespace std;
int a[100000][3];
int main() {
  int i, n = 0, max_n = -1, max_p;
  char ch;
  while (cin >> ch) a[n++][0] = ch - '0';
  for (i = n - 1; i >= 0; --i) {
    if (a[i][0] >= max_n) {
      max_n = a[i][0];
      max_p = i;
    }
    a[i][1] = max_n;
    a[i][2] = max_p;
  }
  for (i = 0; i < n;) {
    cout << (char)(a[i][1] + '0');
    i = a[i][2] + 1;
  }
  return 0;
}
