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: Accepted)

#include <stdio.h>
#include <string.h>
#define cmin(x, y) ((y)<x?x=(y),1:0)
#define cmax(x, y) ((y)>x?x=(y),1:0)
#define dmin(x, y) ((x)<(y)?(x):(y))
#define dmax(x, y) ((x)>(y)?(x):(y))
const int N=2e5+5;
char s[N], cho[N], ans[N];
int f[N], from[N], last[26];
int main() {
	register int n, i, j, k;
	register char *p=ans;
	scanf("%s", s+1);
	n=strlen(s+1);
	for(i=0; i<26; ++i) last[i]=n+1;
	for(i=n; i>=0; --i) {
		register int &F=f[i];
		F=n+1;
		for(j=0; j<26; ++j) {
			k=f[last[j]]+1;
			if(cmin(F, k)) {
				cho[i]=j+'a';
				from[i]=last[j];
			}
		}
		if(i) last[s[i]-'a']=i;
	}
	for(i=0; i!=n+1; i=from[i]) *p++=cho[i];
	puts(ans);
	return 0;
}