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 Java8 (OpenJDK 1.8.0) (judge verdict: Accepted)

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author CodeMonk
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            String s = in.next();
            int[][] next = new int[s.length() + 5][26];
            s = " " + s;
            int len = s.length() - 1;
            for (int i = 0; i < 26; i++)
                next[len + 1][i] = len + 1;
            for (int i = len; i > 0; i--) {
                for (int j = 0; j < 26; j++) {
                    next[i][j] = next[i + 1][j];
                }
                next[i][s.charAt(i) - 'a'] = i;
            }
            int dp[] = new int[len + 500];
            dp[len + 1] = 1;
            for (int i = len; i > 0; i--) {
                dp[i] = len + 1;
                for (int c = 0; c < 26; c++) {
                    dp[i] = Math.min(dp[i], dp[next[i][c] + 1] + 1);
                }
            }
            List<Character> li = new ArrayList<>();
            int cur = 1;
            while (cur <= len) {
                for (int i = 0; i < 26; i++) {
                    if (dp[cur] == dp[next[cur][i] + 1] + 1) {
                        li.add((char) (i + 'a'));
                        cur = next[cur][i] + 1;
                        break;
                    }
                }
            }
            for (Character c : li) {
                out.print(c);
            }
        }

    }
}