#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 9;
int vec[MAX_N];
char s[MAX_N];
int num[26];
int main() {
  int N, M, T;
  while (scanf("%s", s) != EOF) {
    memset(num, 0, sizeof(num));
    int len = strlen(s);
    for (int i = 0; i < len; i++) {
      num[s[i] - 'a']++;
    }
    int res = 0;
    char maxn = 'a';
    for (int i = 25; i >= 0; i--) {
      if (num[i] != 0) {
        maxn = i + 'a';
        res = i;
        break;
      }
    }
    int t = 0;
    while (t < len) {
      if (num[res] == 0) {
        for (int i = 25; i >= 0; i--) {
          if (num[i] != 0) {
            maxn = i + 'a';
            res = i;
            break;
          }
        }
      }
      if (maxn == s[t]) {
        printf("%c", maxn);
      }
      num[s[t] - 'a']--;
      t++;
    }
    printf("\n");
  }
  return 0;
}
