#include <bits/stdc++.h>
using namespace std;
char s[110000];
pair<int, int> mx[110000];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  mx[n] = make_pair(0, n);
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] >= mx[i + 1].first)
      mx[i] = make_pair(s[i], i);
    else
      mx[i] = mx[i + 1];
  }
  for (int i = mx[0].second; i < n; i = mx[i + 1].second)
    printf("%c", mx[i].first);
}
