#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5;
char s[maxn], ans[maxn];
int main() {
  cin >> s;
  int len = 0;
  for (int i = 0; s[i] != '\0'; ++i) {
    while (len > 0 && ans[len - 1] < s[i]) --len;
    ans[len++] = s[i];
  }
  for (int i = 0; i < len; ++i) cout << ans[i];
  cout << endl;
  return 0;
}
