#include <bits/stdc++.h>
using namespace std;
string str;
char res[100010];
int n, sp, p, f[30];
int main() {
  cin >> str;
  n = str.size();
  for (int i = 0; i < n; i++) f[str[i] - 'a']++;
  p = 25;
  for (int i = 0; i < n; i++) {
    while (!f[p]) p--;
    f[str[i] - 'a']--;
    if (str[i] - 'a' == p) {
      res[sp] = 'a' + p;
      sp++;
    }
  }
  res[sp] = '\0';
  cout << res << endl;
}
