Good String
Submissions: 3741   Accuracy:

22.79%

  Difficulty: Basic   Marks: 1

Given a string S of length N, you have to tell whether it is good or not. A good string is one where the distance between every two adjacent character is exactly 1. Here distance is defined by minimum distance between two character when alphabets from 'a' to 'z' are put in cyclic manner. For example distance between 'a' to 'c' is 2 and distance between 'a' to 'y' is also 2. The task is to print "YES" or "NO" (without quotes) depending on whether the given string is Good or not.


Input:
First line of the input contains T denoting the number of test cases.Then T lines follow. Each line contains a string S.


Output:
Print  the answer for each testcase in a separate line.


Constraints:

1≤T≤50
1≤|S|≤50


Note: S contains only lowercase alphabetic characters


Input:
3
aaa
cbc
bcd

Output:
NO
YES
YES

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Siddharth Dungarwal
Author: sd5869


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.