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 (GCC 5.4.1) (judge verdict: Accepted)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define bit(n,m)((n>>m)&1)

char s[200010];
ll a[10000][30];//後ろの方
ll b[10000][30];//前の方
int main(){
	scanf("%s",s);
	ll n=strlen(s);
	
	ll c=0,ss=0;
	for(int i=n-1;i>=0;i--){
		int t=s[i]-'a';
		if(!bit(ss,t)){
			ss|=1<<t;
			a[c][t]=i+1;
		}
		b[c][t]=i+1;
		if(ss==((1<<26)-1)){
			c++;
			ss=0;
		}
	}

	ll p=0;
	for(;c>=0;c--){
		rep(i,0,26)if(a[c][i]<=p){
			putchar(i+'a');
			if(c)p=b[c-1][i];
			break;
		}
	}
	puts("");
	return 0;
}