#include <bits/stdc++.h>
using namespace std;
const unsigned long long INF = 1000 * 1000 * 1000;
const double eps = 1e-9;
int main() {
  string s;
  cin >> s;
  int pos = 0;
  for (char c = 'z'; c >= 'a'; c--) {
    int tek = pos;
    for (int i = tek; i < s.size(); i++)
      if (s[i] == c) {
        cout << s[i];
        pos = i;
      }
  }
  return 0;
}
