#include <bits/stdc++.h>
using namespace std;
string s;
int pos, mp, mn;
char c;
void large() {
  int a[26] = {0};
  int fp[26] = {0};
  int i;
  for (i = pos; i < s.size(); i++) {
    a[s[i] - 97]++;
    fp[s[i] - 97] = i;
  }
  i = 25;
  while (a[i] == 0 && i >= 0) {
    i--;
  }
  c = i + 97;
  mn = a[i];
  mp = fp[i];
}
int main(void) {
  cin >> s;
  int i;
  string ans = "";
  pos = 0;
  while (pos < s.size()) {
    large();
    pos = mp + 1;
    for (i = 0; i < mn; i++) ans += c;
  }
  cout << ans << endl;
  return 0;
}
