#include <bits/stdc++.h>
using namespace std;
int ct[26];
int main() {
  string aux = "", s;
  cin >> s;
  for (int i = 0; i < s.length(); ++i) ct[s[i] - 'a']++;
  for (int i = 0; i < s.length(); ++i) {
    int pos = -1;
    for (int j = 25; j >= 0; j--) {
      if (ct[j] > 0) {
        pos = j;
        break;
      }
    }
    if (pos != -1) {
      if (s[i] == ('a' + pos)) {
        aux += s[i];
      }
    } else
      break;
    ct[s[i] - 'a']--;
  }
  cout << aux << endl;
}
