#include <bits/stdc++.h>
using namespace std;
char str[100010];
vector<int> pos[27];
string ans;
int main() {
  scanf("%s", str);
  int len = strlen(str);
  for (int i = 0; str[i]; i++) pos[str[i] - 'a'].push_back(i);
  int end = 0, next = 0;
  for (int i = 'z' - 'a'; i >= 0; i--) {
    if (pos[i].size() == 0) continue;
    int size = pos[i].size();
    int flag = 0;
    for (int j = 0; j < size; j++) {
      if (pos[i][j] < next) continue;
      ans += (char)(i + 'a');
      flag = 1;
    }
    if (flag) next = pos[i][size - 1];
    if (next == len - 1) break;
  }
  cout << ans << endl;
  return 0;
}
