#include <bits/stdc++.h>
using namespace std;
int arr[100000][26];
int last[26];
struct node {
  int x, y;
};
int main() {
  int n;
  char s[100000];
  int temp;
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i <= 25; i++) {
    arr[0][i] = 0;
  }
  arr[0][(s[0] - 97)]++;
  for (int i = 1; i <= n - 1; i++) {
    for (int j = 0; j <= 25; j++) arr[i][j] = arr[i - 1][j];
    arr[i][(s[i] - 97)]++;
    last[s[i] - 97] = i;
  }
  int cur = 0, j = 25, ctr = 0, sum;
  char ans[100000 + 1];
  while (cur < n && j >= 0) {
    if (cur > 0)
      sum = arr[last[j]][j] - arr[cur - 1][j];
    else
      sum = arr[last[j]][j];
    if (sum <= 0) {
      --j;
      continue;
    }
    cur = last[j] + 1;
    for (int g = 0; g <= sum - 1; g++) ans[ctr++] = 'a' + j;
    --j;
  }
  cout << ans << endl;
  return 0;
}
