#include <bits/stdc++.h>
using namespace std;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, -1, 1};
const double eps = 1e-9;
const int INF = 0x7FFFFFFF;
const long long INFLL = 0x7FFFFFFFFFFFFFFFLL;
const double pi = acos(-1);
struct point_i {
  int x, y;
  point_i(int _x = 0, int _y = 0) {
    x = _x;
    y = _y;
  }
  bool operator<(const point_i &other) {
    if ((*this).x == other.x) return (*this).y < other.y;
    return (*this).x < other.x;
  }
  double dist(const point_i &other) {
    double xx = (*this).x - other.x;
    double yy = (*this).y - other.y;
    return sqrt(xx * xx + yy * yy);
  }
};
struct point {
  double x, y;
  point(double _x = 0, double _y = 0) {
    x = _x;
    y = _y;
  }
  bool operator<(const point &other) const {
    if (fabs(x - other.x) < eps) return y < other.y;
    return x < other.x;
  }
  double dist(const point &other) {
    double xx = (*this).x - other.x;
    double yy = (*this).y - other.y;
    return sqrt(xx * xx + yy * yy);
  }
};
struct line_s {
  point beg, end;
  line_s() {
    beg = point(0, 0);
    end = point(0, 0);
  }
  line_s(point a, point b) : beg(a), end(b) {}
  bool intersect(const line_s &other, point &ans) {
    double mua, mub;
    double denom, numera, numerb;
    denom = (other.end.y - other.beg.y) * (end.x - beg.x) -
            (other.end.x - other.beg.x) * (end.y - beg.y);
    numera = (other.end.x - other.beg.x) * (beg.y - other.beg.y) -
             (other.end.y - other.beg.y) * (beg.x - other.beg.x);
    numerb = (end.x - beg.x) * (beg.y - other.beg.y) -
             (end.y - beg.y) * (beg.x - other.beg.x);
    if (denom == 0 && numera == 0 && numerb == 0) return 0;
    mua = numera / denom;
    mub = numerb / denom;
    if (mua < 0 || mua > 1 || mub < 0 || mub > 1) {
      ans.x = 0;
      ans.y = 0;
      return 0;
    }
    ans.x = beg.x + mua * (end.x - beg.x);
    ans.y = beg.y + mua * (end.y - beg.y);
    return 1;
  }
};
struct line {
  double a, b, c, len;
  line() { a = b = c = 0.0; }
  line(const point &a_, const point &b_) {
    if (fabs(a_.x - b_.x) < eps) {
      a = 1.0;
      b = 0.0;
      c = -a_.x;
    } else {
      a = -(double)(a_.y - b_.y) / (a_.x - b_.x);
      b = 1.0;
      c = -(double)(a_.x * a) - (double)(a_.y * b);
    }
    if (fabs(a) < eps) a = fabs(a);
    if (fabs(b) < eps) b = fabs(b);
    if (fabs(c) < eps) c = fabs(c);
    double x = a_.x - b_.x, y = a_.y - b_.y;
    len = sqrt((x * x) + (y * y));
  }
  bool parallel(const line &other) {
    return (fabs(a - other.a) < eps && fabs(b - other.b) < eps);
  }
  bool same(const line &other) {
    return (*this).parallel(other) && fabs(c - other.c) < eps;
  }
};
double dist(double x1, double y1, double x2, double y2) {
  double x = x1 - x2;
  double y = y1 - y2;
  return (x * x + y * y);
}
double dist(int x1, int y1, int x2, int y2) {
  double x = x1 - x2;
  double y = y1 - y2;
  return (x * x + y * y);
}
string S;
int pos, ch;
queue<int> POZ[30];
int main() {
  cin >> S;
  for (int(i) = (0), _t = ((int)S.size()); i < (_t); ++(i)) {
    POZ[S[i] - 'a'].push(i);
    if (S[i] > ch) {
      pos = i;
      ch = S[i];
    }
  }
  int cp = pos;
  for (int(i) = (S[pos] - 'a'), _t = (0); i >= (_t); --(i))
    if ((int)POZ[i].size()) {
      while (POZ[i].front() < cp) {
        POZ[i].pop();
        if (!(int)POZ[i].size()) break;
      }
      if (!(int)POZ[i].size()) continue;
      do {
        cp = POZ[i].front();
        putchar(i + 'a');
        POZ[i].pop();
      } while ((int)POZ[i].size());
    }
  puts("");
  return 0;
}

### Prompt

Create a solution in Cpp for the following problem:

You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.

We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.

String x = x1x2... x|x| is lexicographically larger than string y = y1y2... y|y|, if either |x| > |y| and x1 = y1, x2 = y2, ... , x|y| = y|y|, or exists such number r (r < |x|, r < |y|), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 > yr + 1. Characters in lines are compared like their ASCII codes.

Input

The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105.

Output

Print the lexicographically maximum subsequence of string s.

Examples

Input

ababba


Output

bbba


Input

abbcbccacbbcbaaba


Output

cccccbba

Note

Let's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).

The first sample: aBaBBA

The second sample: abbCbCCaCbbCBaaBA

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, -1, 1};
const double eps = 1e-9;
const int INF = 0x7FFFFFFF;
const long long INFLL = 0x7FFFFFFFFFFFFFFFLL;
const double pi = acos(-1);
struct point_i {
  int x, y;
  point_i(int _x = 0, int _y = 0) {
    x = _x;
    y = _y;
  }
  bool operator<(const point_i &other) {
    if ((*this).x == other.x) return (*this).y < other.y;
    return (*this).x < other.x;
  }
  double dist(const point_i &other) {
    double xx = (*this).x - other.x;
    double yy = (*this).y - other.y;
    return sqrt(xx * xx + yy * yy);
  }
};
struct point {
  double x, y;
  point(double _x = 0, double _y = 0) {
    x = _x;
    y = _y;
  }
  bool operator<(const point &other) const {
    if (fabs(x - other.x) < eps) return y < other.y;
    return x < other.x;
  }
  double dist(const point &other) {
    double xx = (*this).x - other.x;
    double yy = (*this).y - other.y;
    return sqrt(xx * xx + yy * yy);
  }
};
struct line_s {
  point beg, end;
  line_s() {
    beg = point(0, 0);
    end = point(0, 0);
  }
  line_s(point a, point b) : beg(a), end(b) {}
  bool intersect(const line_s &other, point &ans) {
    double mua, mub;
    double denom, numera, numerb;
    denom = (other.end.y - other.beg.y) * (end.x - beg.x) -
            (other.end.x - other.beg.x) * (end.y - beg.y);
    numera = (other.end.x - other.beg.x) * (beg.y - other.beg.y) -
             (other.end.y - other.beg.y) * (beg.x - other.beg.x);
    numerb = (end.x - beg.x) * (beg.y - other.beg.y) -
             (end.y - beg.y) * (beg.x - other.beg.x);
    if (denom == 0 && numera == 0 && numerb == 0) return 0;
    mua = numera / denom;
    mub = numerb / denom;
    if (mua < 0 || mua > 1 || mub < 0 || mub > 1) {
      ans.x = 0;
      ans.y = 0;
      return 0;
    }
    ans.x = beg.x + mua * (end.x - beg.x);
    ans.y = beg.y + mua * (end.y - beg.y);
    return 1;
  }
};
struct line {
  double a, b, c, len;
  line() { a = b = c = 0.0; }
  line(const point &a_, const point &b_) {
    if (fabs(a_.x - b_.x) < eps) {
      a = 1.0;
      b = 0.0;
      c = -a_.x;
    } else {
      a = -(double)(a_.y - b_.y) / (a_.x - b_.x);
      b = 1.0;
      c = -(double)(a_.x * a) - (double)(a_.y * b);
    }
    if (fabs(a) < eps) a = fabs(a);
    if (fabs(b) < eps) b = fabs(b);
    if (fabs(c) < eps) c = fabs(c);
    double x = a_.x - b_.x, y = a_.y - b_.y;
    len = sqrt((x * x) + (y * y));
  }
  bool parallel(const line &other) {
    return (fabs(a - other.a) < eps && fabs(b - other.b) < eps);
  }
  bool same(const line &other) {
    return (*this).parallel(other) && fabs(c - other.c) < eps;
  }
};
double dist(double x1, double y1, double x2, double y2) {
  double x = x1 - x2;
  double y = y1 - y2;
  return (x * x + y * y);
}
double dist(int x1, int y1, int x2, int y2) {
  double x = x1 - x2;
  double y = y1 - y2;
  return (x * x + y * y);
}
string S;
int pos, ch;
queue<int> POZ[30];
int main() {
  cin >> S;
  for (int(i) = (0), _t = ((int)S.size()); i < (_t); ++(i)) {
    POZ[S[i] - 'a'].push(i);
    if (S[i] > ch) {
      pos = i;
      ch = S[i];
    }
  }
  int cp = pos;
  for (int(i) = (S[pos] - 'a'), _t = (0); i >= (_t); --(i))
    if ((int)POZ[i].size()) {
      while (POZ[i].front() < cp) {
        POZ[i].pop();
        if (!(int)POZ[i].size()) break;
      }
      if (!(int)POZ[i].size()) continue;
      do {
        cp = POZ[i].front();
        putchar(i + 'a');
        POZ[i].pop();
      } while ((int)POZ[i].size());
    }
  puts("");
  return 0;
}

```