文章
27
粉丝
0
获赞
80
访问
2.4k
#include <iostream>
#include <vector>
#include <string>
using namespace std;
bool check(string str){
for(size_t i=0;i<str.size()-1;i++){
if(str[i]>='a'&&str[i]<='z'){
if((str[i]-'a'+2)%26!=str[i+1]-'a'&&str[i+1]!=str[i]-32)return false;
}else{
if((str[i+1]-'A'+2)%26!=str[i]-'A'&&str[i+1]!=str[i]+32)return false;
}
}
return true;
}
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
string str;
cin>>str;
if(check(str))cout<<"Y"<<"\n";
else cout<<"N"<<"\n";
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发