#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
char ans[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long int j = 0;
  for (long long int i = 0; i < s.length(); i++) {
    while (j != 0 && ans[j] < s[i]) ans[j--] = 0;
    j++;
    ans[j] = s[i];
  }
  printf("%s", ans + 1);
}
