#include <bits/stdc++.h>
using namespace std;
int di[] = {0, 0, 1, -1, -1, -1, 1, 1, 0};
int dj[] = {1, -1, 0, 0, 1, -1, 1, -1, 0};
int main() {
  string s, res = "";
  cin >> s;
  int idx = -1;
  for (char c = 'z'; c >= 'a'; c--)
    for (int i = (0); i < ((int)s.size()); i++)
      if (s[i] == c && i > idx) res += s[i], idx = i;
  cout << res << endl;
  return 0;
}
