#include <bits/stdc++.h>
using namespace std;
char str[101000];
int cnt[30];
int q[30][101000];
void deal() {
  int len = strlen(str);
  memset((cnt), (0), sizeof(cnt));
  for (int _n(len), i(0); i < _n; i++) {
    int te = str[i] - 'a';
    q[te][cnt[te]++] = i;
  }
  int loc = 1077952576, flage = 1;
  for (int i = (25), _b = (0); i >= _b; --i) {
    for (int _n(cnt[i]), j(0); j < _n; j++) {
      if (flage || q[i][j] > loc) {
        loc = q[i][j];
        flage = 0;
        char c = 'a' + i;
        cout << c;
      }
    }
  }
  cout << endl;
}
int main() {
  while (cin >> str) {
    deal();
  }
  return 0;
}
