EZ Programming Contest #1 |
---|
Finished |
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:
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?
The 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.
For each test case, output YES if it is possible to make $$$s$$$ easy after some (possibly zero) operations. Otherwise, output NO.
3 ezpcabdfghijklmnoqrstuvwxy zaepbcdfghijklmnoqrstuvwxy orzgvlkbenwyqjmdfsctxhiaup
YES YES NO
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.
Name |
---|