#include <bits/stdc++.h>
char c[100005];
int x[30];
int main() {
  int n;
  while (~scanf("%s", c)) {
    memset(x, 0, sizeof(x));
    n = strlen(c);
    for (int i = 0; i < n; i++) x[c[i] - 'a']++;
    int i = 0;
    for (int j = 25; j >= 0; j--) {
      while (i < n && x[j] != 0) {
        if (c[i] == j + 'a') {
          printf("%c", c[i]);
          x[j]--;
        } else
          x[c[i] - 'a']--;
        i++;
      }
    }
    puts("");
  }
}
