//#include "main.h"
#include<bits/stdc++.h>
#include <stdio.h>
#include <vector>
using namespace std;
bool isEcho(string &s) {
if (s.empty())return true;
int l = 0, r = s.size() - 1;
while (l <= r) {
if (s[l] != s[r]) {
return false;
} else {
l++;
r--;
}
}
return true;
}
string solution(string &s) {
if (isEcho(s)) {
return "YES";
}
string temp;
for (const auto &item: s) {
if (item == 'w') {
temp += "vv";
} else if (item == 'm') {
temp += "nn";
} else if (item == 'b') {
temp += "d";
} else if (item == 'p') {
temp += "d";
} else if (item == 'q') {
temp += "d";
} else if (item == 'u') {
temp += "n";
} else {
temp += item;
}
}
if (isEcho(temp)) {
return "YES";
} else {
return "NO";
}
return "YES";
}
int main() {
int n;
cin >> n;
vector<string> s;
for (int i = 0; i < n; ++i) {
string temp;
cin >> temp;
s.push_back(temp);
}
for (auto &item: s) {
cout << solution(item) << endl;
}
return 0;
}
/*
7
wovv
bod
pdd
moom
lalalai
wwoo
wwwnoo
YES
YES
YES
YES
No
No
*/
小红书2023-8-19 笔试题2
最新推荐文章于 2024-07-24 11:32:27 发布