#include <bits/stdc++.h>
using namespace std;
int lst[100010];
int main() {
  int T, n;
  string str;
  cin >> str;
  int len = str.length();
  memset(lst, -1, sizeof(lst));
  lst[len] = -1;
  for (int i = len - 1; i >= 0; i--) {
    lst[i] = max(str[i] - 'a', lst[i + 1]);
  }
  for (int i = 0; i < len; i++) {
    if (str[i] - 'a' < lst[i])
      continue;
    else
      cout << str[i];
  }
  return 0;
}
