#include <bits/stdc++.h>
using namespace std;
char s[100100];
string p;
int main() {
  gets(s);
  int n = strlen(s);
  p = s[n - 1];
  for (int i = (n - 1) - 1; i > -1; i--)
    if (p[p.length() - 1] <= s[i]) p += s[i];
  reverse(p.begin(), p.end());
  cout << p;
}
