#include <bits/stdc++.h>
using namespace std;
int suf[30];
int main() {
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n; i++) suf[s[i] - 'a']++;
  for (int i = 0; i < n; i++) {
    int max = -1;
    for (int j = 0; j < 30; j++)
      if (suf[j] != 0) max = j;
    if (s[i] - 'a' == max) cout << s[i];
    suf[s[i] - 'a']--;
  }
  return 0;
}
