NOI Contest Archive

Archive / 2020 / December 2020

Adjacent Strings

Easy · National Olympiad in Informatics Sri Lanka - December 2020

A string is said to be adjacent if it contains distinct letters and the string is made from an adjacent segment of the English alphabet.

“pqrs” is an adjacent segment of the alphabet. So “pqrs”, “srqp”, “qprs” and “rspq” adjacent strings, but “ppqrs”, “ssrpq” and “rrqps” are not.

You are given n strings. If the given string is an adjacent string print “Yes”, otherwise print “No”.

Input Format

First line will be a single integer n, the number of input strings. Following n lines will have a string in each line.

Output Format

n lines containing answers(either “Yes” or “No”) for each query

Constraints

Limits

Sample Input 0

3
pqrs
rspq
pqs

Sample Output 0

Yes
Yes
No