#include <bits/stdc++.h>
using namespace std;
int pot(int x, int y) {
  if (y == 0) {
    return 1;
  } else {
    return x * pot(x, y - 1);
  }
}
int bin(int x, int y) {
  if ((x == 0 && y != 0) || (y == 0 && x != 0)) {
    return 1;
  } else {
    return bin(x, y - 1) + bin(x - 1, y);
  }
}
void strlwr(string& s) {
  for (int i = 0; (unsigned)i < s.size(); i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      s[i] += 32;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a[26] = {};
  int n;
  string s;
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    a[s[i] - 'a']++;
  }
  int k = 25;
  for (int i = 0; i < n; i++) {
    while (a[k] == 0 && k > 0) {
      k--;
    }
    if (s[i] - 'a' < k) {
      a[s[i] - 'a']--;
    }
    if (s[i] - 'a' == k) {
      a[s[i] - 'a']--;
      cout << s[i];
    }
  }
  return 0;
}
