文章
124
粉丝
0
获赞
137
访问
8.8k
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
string str;
for(int i=0;i<n;i++){
cin >> str;
int len = str.length();
int tag = 1;
for(int j=0;j<len-1;j++){
if(str[j] >= 'a' && str[j] <= 'z'){
if(str[j+1] == toupper(str[j]) || str[j+1] == 'a'+(str[j]-'a'+2)%26){
tag = 1;
}
else{
tag = 0;
break;
}
}
else if(str[j] >= 'A' && str[j] <= 'Z'){
if(str[j+1] == tolower(str[j]) || str[j+1] == 'A'+(str[j]-'A'-2+26)%26 ){ //+26避免负数!!!
tag = 1;
}
else{
tag = 0;
break;
}
}
}
if(tag == 1)
cout << "Y" << endl;
else
cout << "N" << endl;
}
}
登录后发布评论
暂无评论,来抢沙发