#include <bits/stdc++.h>
using namespace std;
int a[30], col[100100] = {};
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < 26; i++) a[i] = -1;
  for (int i = 0; i < s.size(); i++) a[s[i] - 'a'] = i;
  int p = 25;
  for (int i = 0;;) {
    while (p >= 0 && a[p] < i) p--;
    if (p < 0) break;
    int col = 0;
    while (i <= a[p]) {
      if (s[i] - 'a' == p) col++;
      i++;
    }
    for (int j = 0; j < col; j++) cout << s[a[p]];
    p--;
  }
}
