405890: GYM102152 H The Universal String

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. The Universal Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Have you ever heard about the universal string? This is the largest string in the world, and it is the mother of all strings that will ever exist in any programming language!

The universal string is an infinite string built by repeating the string "abcdefghijklmnopqrstuvwxyz" infinitely. So, the universal string will look like this:

"....nopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm...."

You are given a string $$$p$$$ and your task is to determine if $$$p$$$ is a substring of the universal string. Can you?

A substring of $$$s$$$ is a non-empty string $$$x$$$ = $$$s$$$[$$$l$$$$$$\dots$$$ $$$r$$$] = $$$s_l$$$$$$s_{l+1}$$$$$$\dots$$$ $$$s_r$$$ (1 $$$\le$$$ $$$l$$$ $$$\le$$$ $$$r$$$ $$$\le$$$ |$$$s$$$|). For example, "code" and "force" are substring of "codeforces", while "coders" is not.

Input

The first line contains an integer $$$T$$$ ($$$1 \le T \le 10^3$$$) specifying the number of test cases.

Each test consists of a single line containing a non-empty string $$$p$$$ of length no more $$$10^3$$$ and consisting only of lowercase English letters.

Output

For each test case, print "YES" (without quotes) if the given string is a substring of the universal string. Otherwise, print "NO" (without quotes).

ExampleInput
3
abcde
abd
wxyzabc
Output
YES
NO
YES

加入题单

上一题 下一题 算法标签: