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 Perl6 (rakudo-star 2016.01) (judge verdict: Runtime Error)

$in1=in();
@ary=split //,$in1;
for($i=0;$i<26;$i++){
${$to[@ary]}[$i]=@ary;
}for($i=@ary-1;$i>=0;$i--){
for($j=0;$j<26;$j++){
${$to[$i]}[$j]=${$to[$i+1]}[$j];
}${$to[$i]}[ord($ary[$i])-ord('a')]=$i;
}
for($j=0;$j<26;$j++){
if(!defined $pop[${$to[0]}[$j]] or $pop[${$to[0]}[$j]]>1){
$pop[${$to[0]}[$j]]=1;
$ans[${$to[0]}[$j]]=chr(ord('a')+$j);
}}

for($i=0;$i<@ary;$i++){
for($j=0;$j<26;$j++){
if(!defined $pop[${$to[$i+1]}[$j]] or $pop[${$to[$i+1]}[$j]]>$pop[$i]+1){
$pop[${$to[$i+1]}[$j]]=$pop[$i]+1;
$ans[${$to[$i+1]}[$j]]=$ans[$i].chr(ord('a')+$j);
}}
}

print "$ans[@ary]";
sub in {
$t=<STDIN>;
$t=~s/[¥r¥n]+//;
return $t;
}