408489: GYM103150 C EZPC Sort
Description
You are given a rearrangement of the string abcdefghijklmnopqrstuvwxyz. Call it $$$s$$$. You can perform the following operation on $$$s$$$ as many times as you want:
- Sort any substring of $$$s$$$ in increasing order. (Recall that $$$a$$$ is a substring of $$$b$$$ if $$$a$$$ can be obtained by deleting some (possibly zero) characters from the beginning and end of $$$b$$$.)
The string is called easy if you can delete some of the characters in $$$s$$$ to make $$$s$$$ equal to the string ezpc. Is it possible to make $$$s$$$ easy after some (possibly zero) operations?
InputThe input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 5000$$$) — the number of test cases.
The only line of each test case consists of a single string $$$s$$$ — the initial string. $$$s$$$ is a rearrangement of the string abcdefghijklmnopqrstuvwxyz.
OutputFor each test case, output YES if it is possible to make $$$s$$$ easy after some (possibly zero) operations. Otherwise, output NO.
ExampleInput3 ezpcabdfghijklmnoqrstuvwxy zaepbcdfghijklmnoqrstuvwxy orzgvlkbenwyqjmdfsctxhiaupOutput
YES YES NONote
In the first test case, $$$s$$$ is already easy (so you don't need to perform any operations). You can delete the last $$$22$$$ characters of $$$s$$$, and you will be left with the string ezpc.
In the second test case, you can make $$$s$$$ easy with one operation: zaepcbdefgh... $$$\rightarrow$$$ aezpbcdefgh....
Now, you can delete the first character, the fourth character, and the last $$$20$$$ characters in $$$s$$$ to make the string ezpc: _ezp_c___.... Here the deleted letters are represented with _.
It can be shown that it is impossible to make the string in the third test case easy.