#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int maxn = 2e5 + 10;
const long long MOD = 1000000007;
const double EPS = 1e-10;
const double Pi = acos(-1.0);
int a[30];
string s;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) a[s[i] - 'a']++;
  string ans;
  int cnt = 0;
  for (int i = 25; i >= 0; i--)
    if (a[i] > 0) {
      int k = cnt;
      for (int j = 0; j < a[i]; j++) {
        while (k < s.size() && s[k] - 'a' != i) k++;
        if (k >= s.size()) break;
        ans += s[k];
        cnt = k + 1;
        k++;
      }
      if (cnt >= s.size()) break;
    }
  cout << ans << endl;
  return 0;
}
