#include <bits/stdc++.h>
using namespace std;
const int MAXX = 1e5 + 10;
int ps[MAXX][36], l[36], mxl;
string s;
char mx = 0;
int cal_ps(char c) {
  int ans_c = ps[l[c - 'a']][c - 'a'] - ps[mxl][c - 'a'];
  if (s[mxl] == c) ans_c++;
  return ans_c;
}
void Fill_ps() {
  for (char c = 'a'; c <= 'z'; c++)
    for (int i = 0; i < s.size(); i++)
      (s[i] == c) ? ps[i][c - 'a'] = ps[i - 1][c - 'a'] + 1
                  : ps[i][c - 'a'] = ps[i - 1][c - 'a'];
  for (int i = 0; i < s.size(); i++) mx = max(s[i], mx);
  for (int i = 0; i < s.size(); i++) l[s[i] - 'a'] = i;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> s;
  Fill_ps();
  for (char c = mx; c >= 'a'; c--) {
    for (int i = 0; i < cal_ps(c); i++) cout << c;
    mxl = max(l[c - 'a'], mxl);
  }
  return cout << endl, 0;
}
