#include <bits/stdc++.h>
using namespace std;
int a[30];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  string s;
  int len;
  cin >> s;
  len = s.size();
  for (int i = 0; i < len; i++) a[s[i] - 'a']++;
  char charCurr = 'z';
  string ans = "";
  bool exit = false;
  for (int i = 0; i < len and !exit; i++) {
    while (a[charCurr - 'a'] == 0) {
      charCurr--;
      if (charCurr < 'a') {
        exit = true;
        break;
      }
    }
    if (exit) break;
    if (s[i] == charCurr) ans += s[i];
    a[s[i] - 'a']--;
  }
  cout << ans << "\n";
  return 0;
}
