#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:94777216")
using namespace std;
string st;
int din[100001][26];
int ls[26];
int main() {
  cin >> st;
  int n = st.length();
  for (int i = 0; i < 26; i++) ls[i] = -1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 26; j++) din[i][j] = din[i - 1][j];
    din[i][st[i - 1] - 'a']++;
    ls[st[i - 1] - 'a'] = i - 1;
  }
  int p = 0;
  for (int i = 25; i >= 0; i--) {
    if (ls[i] != -1) {
      bool b = 0;
      for (int j = 0; j < din[ls[i] + 1][i] - din[p][i]; j++) {
        cout << (char)('a' + i);
        b = 1;
      }
      if (b) p = ls[i] + 1;
    }
    if (p == n) return 0;
  }
  return 0;
}
