#include <bits/stdc++.h>
using namespace std;
int i, j, N, M, r, n, m;
char* s;
int a[30] = {0};
int main(void) {
  s = new char[100010];
  cin >> s;
  int i = strlen(s);
  char max = s[--i];
  for (; i >= 0; i--) {
    if (s[i] >= max) {
      a[s[i] - 'a']++;
      if (s[i] > max) max = s[i];
    }
  }
  for (i = 26; i >= 0; i--) {
    if (a[i] > 0) {
      for (j = 0; j < a[i]; j++) cout << char(i + 'a');
    }
  }
  return 0;
}
