#include <bits/stdc++.h>
using namespace std;
int main() {
  char str[100005], str1[100005];
  while (~scanf("%s", str)) {
    int len = strlen(str);
    char c = 0;
    int j = 0;
    for (int i = len - 1; i >= 0; i--) {
      if (str[i] >= c) str1[j++] = c = str[i];
    }
    for (int i = j - 1; i >= 0; i--) {
      printf("%c", str1[i]);
    }
    printf("\n");
  }
  return 0;
}
