Sumit's String
/
No tags
Problem
Editorial
Analytics

Given a string 'S' , u need to tell whether it is 'sumit's string or not'.

A string is called 'Sumit's String' , if distance between adjacent character is 1.

Consider that the alphabets are arranged in cyclic manner from 'a' to 'z'. distance between any character 'x' and 'y' will be defined as minimum number of steps it takes 'x' to reach 'y'. Here, character 'x' can start moving clockwise or anti-clockwise in order to reach at position where character 'y' is placed.

Print 'YES' if it is Sumit's string else print 'NO', for each yest case.

Input :

• test cases, t
• string , s

Output:

Desired O/p

Constraints :

• string length<=250
• string has only lower case letters
SAMPLE INPUT
3
aba
zza
bcd
SAMPLE OUTPUT
YES
NO
YES
Explanation

Sample Case 1: 'aba' is a Sumit's string , since all the adjacent characters are exactly 1 unit of distance apart.

Sample Case 2: 'zza' is not a Sumit's string since 'z' and 'z' are at the same position and hence 0 distance apart.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

## Contributors

Initializing Code Editor...