#include <bits/stdc++.h>
using namespace std;
int last[26];
int nxt[100000][26];
int main() {
  string s;
  cin >> s;
  int L = s.size();
  for (int i = 0; i < 26; ++i) last[i] = L;
  for (int i = L - 1; i >= 0; --i) {
    last[s[i] - 'a'] = i;
    for (int j = 0; j < 26; ++j) nxt[i][j] = last[j];
  }
  int pos = 0;
  while (pos < L) {
    for (int i = 25; i >= 0; --i) {
      int to = nxt[pos][i];
      if (to < L) {
        cout << (char)('a' + i);
        pos = nxt[pos][i] + 1;
        break;
      }
    }
  }
  cout << '\n';
  return 0;
}
