#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
char sequence[100010];
int main(int argc, const char* argv[]) {
  string str;
  string output;
  cin >> str;
  unsigned long long length = str.length();
  char biggestChar = 'a';
  int j = 0;
  sequence[0] = -1;
  for (int i = 0; i < length; i++) {
    if (str[i] > biggestChar) {
      biggestChar = str[i];
      for (int k = 0; k < i; k++) {
        sequence[k] = -1;
      }
      j = 0;
      sequence[j] = biggestChar;
    } else if (str[i] <= sequence[j]) {
      j++;
      sequence[j] = str[i];
    } else {
      int k;
      for (k = j; str[i] > sequence[k] && k >= 0; k--) {
      }
      k++;
      j = k;
      sequence[k] = str[i];
    }
  }
  for (int i = 0; i < j + 1; i++) {
    printf("%c", sequence[i]);
  }
  printf("\n");
  return 0;
}
