#include <bits/stdc++.h>
using namespace std;
int prox[110000][26];
char s[110000];
int n;
void solve(int pos) {
  if (pos == n) return;
  for (int i = 25; i >= 0; i--) {
    if (prox[pos][i] != n) {
      printf("%c", i + 'a');
      solve(prox[pos][i] + 1);
      return;
    }
  }
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int j = 0; j < 26; j++) prox[n][j] = n;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) {
      if (s[i] == 'a' + j)
        prox[i][j] = i;
      else
        prox[i][j] = prox[i + 1][j];
    }
  }
  solve(0);
  printf("\n");
  return 0;
}
