Don't Be a Subsequence

AtCoder
IDarc081_c
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
atcoderregularcontest
Output #1
b

The string `atcoderregularcontest` contains `a` as a subsequence, but not `b`.
Input #2
abcdefghijklmnopqrstuvwxyz
Output #2
aa
Input #3
frqnvhydscshfcgdemurlfrutcpzhopfotpifgepnqjxupnskapziurswqazdwnwbgdhyktfyhqqxpoidfhjdakoxraiedxskywuepzfniuyskxiyjpjlxuqnfgmnjcvtlpnclfkpervxmdbvrbrdn
Output #3
aca
API Response (JSON)
{
  "problem": {
    "name": "Don't Be a Subsequence",
    "description": {
      "content": "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 (",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc081_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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 (...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments