Brother Hu has a string $S$ consisting of lowercase English letters.
He does not like sussy substrings — two adjacent characters which are cyclically adjacent in the English alphabet.
For example, cd
, fe
, az
and za
are sussy substrings.
To eliminate sussy substrings from $S$, Brother Hu repeats the following procedure
until no more sussy substrings are found in $S$:
- Find the first sussy substring in $S$.
- Remove the first character of the sussy substring.
For instance, bcedd
$\implies$ cedd
$\implies$ cdd
$\implies$ dd
.
Now, the string does not contain sussy substrings, so Brother Hu is happy with the string.
Currently, Brother Hu is busy eating the candy given by Rock. Help him eliminate sussy substrings from $S$ as described above.
Input
The only line of input contains the string $S$.
Output
Output the resulting string after eliminating sussy substrings.
Constraints
Subtask 1 (50%): $1 \le |S| \le 10^3$
Subtask 2 (50%): $1 \le |S| \le 10^6$
Sample Test Cases
Input | Output | |
---|---|---|
bcedd | dd | |
mlkjihgfedcbazyxwvutsrqpon | n |
Scoring: Per Subtask
Authored by s16f22
Appeared in 2022 Mini Contest 0