#include <bits/stdc++.h>
using namespace std;
vector<int> gra[28];
char s[100005], re[100005];
int main() {
  int i, l, j, st, l1;
  while (scanf("%s", &s) == 1) {
    l = strlen(s);
    l1 = 0;
    for (i = 0; i < 26; i++) gra[i].clear();
    for (i = 0; i < l; i++) gra[s[i] - 'a'].push_back(i);
    st = -1;
    for (i = 25; i >= 0; i--)
      if (gra[i].size() > 0) {
        for (j = 0; j < gra[i].size(); j++)
          if (gra[i][j] > st) re[l1++] = 'a' + i, st = gra[i][j];
      }
    re[l1] = '\0';
    printf("%s\n", re);
  }
  return 0;
}
