
题解:
#include<bits/stdc++.h>
using namespace std;
bool check(string str){
for (int i = 0; i < str.size() - 1; i++){
if(str[i] <= 'z' && str[i] >= 'a'){
if(str[i+1] != str[i] - 'a' + 'A' && str[i+1] != (str[i]- 'a' + 2 + 26) %26 + 'a'){
return false;
}
}else if(str[i] <= 'Z' && str[i] >= 'A'){
if(str[i+1] != str[i] - 'A' + 'a' && str[i+1] != (str[i]- 'A' - 2 + 26)%26 + 'A'){
return false;
}
}else{
return false;
}
}
return true;
}
int main(){
int n;
string str;
cin>>n;
while(n--){
cin>>str;
if(check(str)){
cout<<"Y"<<endl;
}else{
cout<<"N"<<endl;
}
}
}