string s of length n (1≤n≤26) is called sequential on the off chance that it very well may be gotten utilizing the accompanying calculation: to begin with, compose a vacant string to s (for example play out the task s := ""); then, at that point, play out the following stage n times; at the I-th step take I-th lowercase letter of the Latin letters in order and compose it either to the left of
Correct answer will upvoted else downvoted.
string s of length n (1≤n≤26) is called sequential on the off chance that it very well may be gotten utilizing the accompanying calculation: to begin with, compose a vacant string to s (for example play out the task s := ""); then, at that point, play out the following stage n times; at the I-th step take I-th lowercase letter of the Latin letters in order and compose it either to the left of the string s or to the right of the string s (for example play out the task s := c+s or s := s+c, where c is the I-th letter of the Latin letters in order).
At the end of the day, emphasize over the n first letters of the Latin letter set beginning from 'a' and so on Each time we prepend a letter to the left of the string s or annex a letter to the right of the string s. Strings that can be gotten in that manner are in sequential order. For instance, the accompanying strings are in sequential order: "a", "ba", "stomach muscle", "bac" and "ihfcbadeg". The accompanying strings are not in order: "z", "aa", "ca", "acb", "xyz" and "ddcba". From the given string, decide whether it is sequential.
Input :The principal line contains one integer t (1≤t≤104) — the number of experiments. Then, at that point, t experiments follow. Each experiment is composed on a different line that contains one string s. String s comprises of lowercase letters of the Latin letters in order and has a length somewhere in the range of 1 and 26, comprehensive.
Output :Output t lines, every one of them should contain the response to the relating experiment. Output YES if the given string s is sequential and NO in any case. You can output YES and NO regardless (for instance, strings yEs, indeed, Yes and YES will be perceived as a positive reply).
Step by step
Solved in 4 steps with 1 images