题解
2024-01-28 11:02:43
发布于:北京
8阅读
0回复
0点赞
#include <iostream>
#include <cstring>
using namespace std;
int main() {
int t, n, a = 0, m = 0;
string s;
cin >> t;
while (t--) {
a = 0;
m = 0;
cin >> n;
cin >> s;
for (int i = 0; i < n; ++i) {
if (a == 0 && s[i] != 'M' && s[i] != 'm') {
if (s[i] == 'e' || s[i] == 'E') {
++a;
} else {
m = 1;
break;
}
}
if (a == 1 && s[i] != 'e' && s[i] != 'E') {
if (s[i] == 'o' || s[i] == 'O') {
++a;
} else {
m = 1;
break;
}
}
if(a == 2 && s[i] != 'o' && s[i] != 'O') {
if (s[i] == 'W' || s[i] == 'w') {
++a;
} else {
m = 1;
break;
}
}
if (a == 3 && s[i] != 'w' && s[i] != 'W') {
m = 1;
break;
}
}
if (a == 3 && m == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
return 0;
}
这里空空如也
有帮助,赞一个