#include <bits/stdc++.h>
using namespace std;
int n, cnt[200];
char input[100050];
int main() {
  cin >> input;
  n = strlen(input);
  for (int i = 0; i < n; i++) cnt[input[i]]++;
  int cur = 'z';
  for (int i = 0; i < n; i++) {
    while (cnt[cur] == 0) cur--;
    if (input[i] == cur) putchar(input[i]);
    cnt[input[i]]--;
  }
  puts("");
  return 0;
}
