Problem:
Score : 600 points

Problem Statement

A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters.
For example, arc, artistic and (an empty string) are all subsequences of artistic; abc and ci are not.

You are given a string A consisting of lowercase English letters.
Find the shortest string among the strings consisting of lowercase English letters that are not subsequences of A.
If there are more than one such string, find the lexicographically smallest one among them.

Constraints

1 \leq |A| \leq 2 \times 10^5

A consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

A

Output

Print the lexicographically smallest string among the shortest strings consisting of lowercase English letters that are not subsequences of A.

Sample Input 1

atcoderregularcontest

Sample Output 1

b

The string atcoderregularcontest contains a as a subsequence, but not b.

Sample Input 2

abcdefghijklmnopqrstuvwxyz

Sample Output 2

aa

Sample Input 3

frqnvhydscshfcgdemurlfrutcpzhopfotpifgepnqjxupnskapziurswqazdwnwbgdhyktfyhqqxpoidfhjdakoxraiedxskywuepzfniuyskxiyjpjlxuqnfgmnjcvtlpnclfkpervxmdbvrbrdn

Sample Output 3

aca

Solution in C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include<bits/stdc++.h>
using namespace std;int nu[200010]={};
int main(){  
  string a;
  cin>>a;
  int cnt[30]={};
  int cu=0,nu=1;
  int num[200010]={};
  for(int i=a.size();i>=0;i--){
    int ni=a[i]-'a';
     num[i]=nu;
    if(cnt[ni])continue;
    cnt[ni]++;
    cu++;
    if(cu==26){
      nu++;
      cu=0;
      for(int i=0;i<30;i++)cnt[i]=0;
    }
  }
  string k;
  if(cu==0){
    k+='a';
  }else{
    for(int i=0;i<30;i++){
      if(cnt[i])continue;
      k+=i+'a';
      break;
    }
  }
  //cout<<a<<endl;
  // for(int i=0;i<a.size();i++)cout<<num[i];
  //cout<<endl;
  // cout<<"ddddddddd"<<endl;
  
  int nowi=0,i=0;
  while(1){
    if(k.size()==nu)break;
    while(k[nowi]!=a[i++]);
    int cn[30]={};
    while(1){
      if(i==a.size())break;
      cn[a[i]-'a']++;
      i++;
      if(i==a.size())break;
      if(num[i-1]!=num[i])break;
    }
    for(int j=0;j<30;j++){
      if(cn[j])continue;
      k+=j+'a';
      break;
    }
    nowi++;
  }
  cout<<k<<endl;
  return 0;
}