#include <bits/stdc++.h>
using namespace std;
long long labs(long long a) { return a < 0 ? (-a) : a; }
const int MAXA = 30;
vector<int> pos[MAXA];
int main() {
  string s;
  cin >> s;
  int n = s.size();
  for (int(i) = 0; (i) < (n); (i)++) {
    pos[s[i] - 'a'].push_back(i);
  }
  int maxi = -1;
  string r = "";
  for (int(i) = (MAXA)-1; (i) >= 0; (i)--) {
    int cnt = 0;
    for (int(j) = 0; (j) < (pos[i].size()); (j)++) {
      cnt += pos[i][j] > maxi;
    }
    if (cnt) {
      maxi = pos[i].back();
      r += string(cnt, 'a' + i);
    }
  }
  cout << r << endl;
  return 0;
}
