#include <bits/stdc++.h>
using namespace std;
string s;
int a[111111], res[111111], n;
void excute() {
  int cnt = 0;
  res[0] = a[n - 1];
  int crr = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    if (a[i] >= crr) {
      res[++cnt] = a[i];
      crr = a[i];
    }
  }
  for (int i = cnt; i >= 0; i--) {
    char c = res[i];
    printf("%c", res[i]);
  }
}
int main() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    a[i] = s[i];
  }
  excute();
}
