atcoder#ARC081C. [ARC081E] Don't Be a Subsequence
[ARC081E] Don't Be a Subsequence
Score : points
Problem Statement
A subsequence of a string is a string that can be obtained by deleting zero or more characters from 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 consisting of lowercase English letters. Find the shortest string among the strings consisting of lowercase English letters that are not subsequences of . If there are more than one such string, find the lexicographically smallest one among them.
Constraints
- consists of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print the lexicographically smallest string among the shortest strings consisting of lowercase English letters that are not subsequences of .
atcoderregularcontest
b
The string atcoderregularcontest
contains a
as a subsequence, but not b
.
abcdefghijklmnopqrstuvwxyz
aa
frqnvhydscshfcgdemurlfrutcpzhopfotpifgepnqjxupnskapziurswqazdwnwbgdhyktfyhqqxpoidfhjdakoxraiedxskywuepzfniuyskxiyjpjlxuqnfgmnjcvtlpnclfkpervxmdbvrbrdn
aca