#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
int cnt[30] = {};
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < (int)s.length(); ++i) cnt[s[i] - 'a']++;
  for (int i = 0; i < (int)s.length(); ++i) {
    int cur = s[i];
    bool ok = true;
    for (int j = cur - 'a' + 1; j < 26; ++j)
      if (cnt[j]) ok = false;
    if (ok) putchar(cur);
    cnt[cur - 'a']--;
  }
  return 0;
}
