#include <bits/stdc++.h>
using namespace std;
char s[100001];
int a[30];
char ans[100001];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  memset(ans, 0, sizeof(ans));
  memset(a, 0, sizeof(a));
  for (int i = 0; i < n; i++) {
    a[s[i] - 'a']++;
  }
  int j = 30;
  int k = 0;
  for (int i = 0; i < n; i++) {
    while (a[j] == 0) {
      j--;
    }
    if (j == s[i] - 'a') {
      ans[k] = s[i];
      k++;
    }
    a[s[i] - 'a']--;
  }
  printf("%s\n", ans);
  return 0;
}
