#include <bits/stdc++.h>
using namespace std;
string str;
string ans;
int rightest[27];
int acu_sum[100010][27];
int main() {
  cin >> str;
  for (int j = 0; j < 26; ++j)
    for (int i = str.size() - 1; i >= 0; --i) {
      acu_sum[i][j] += acu_sum[i + 1][j];
      if (str[i] == (char)('a' + j)) {
        if (acu_sum[i][j] == 0) rightest[j] = i;
        acu_sum[i][j] += 1;
      }
    }
  int pos = 0;
  for (int i = 25; i >= 0; --i) {
    for (int j = 0; j < acu_sum[pos][i]; ++j) ans += (char)('a' + i);
    if (pos < rightest[i]) pos = rightest[i];
  }
  cout << ans << '\n';
  return 0;
}
