#include <bits/stdc++.h>
using namespace std;
int main() {
  int *last, i, i2;
  last = new int[26];
  for (i = 0; i < 26; i++) {
    last[i] = -1;
  }
  string text;
  cin >> text;
  for (i = 0; i < text.size(); i++) {
    last[text[i] - 'a'] = i;
  }
  i = 0;
  i2 = 25;
  while (i > last[i2] && i2 >= 0) i2--;
  while (i < text.size() && i2 >= 0) {
    if (text[i] - 'a' == i2) cout << text[i];
    i++;
    while (i > last[i2] && i2 >= 0) i2--;
  }
  delete[] last;
  return 0;
}
