#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin >> a;
  vector<int> alf(27);
  string alpha = "abcdefghijklmnopqrstuvwxyz";
  int max = 0;
  for (int i = 0; i < a.length(); i++)
    for (int j = 0; j <= 25; j++)
      if (alpha[j] == a[i] && j > max) max = j;
  int l = 0;
  for (int ch = max; ch >= 0; ch--)
    for (int i = l; i < a.length(); i++) {
      if (a[i] == alpha[ch]) {
        l = i + 1;
        alf[ch]++;
      }
    }
  for (int i = 25; i >= 0; i--)
    for (int j = 0; j < alf[i]; j++) cout << alpha[i];
  return 0;
}
