-
Notifications
You must be signed in to change notification settings - Fork 0
/
icpcE.cpp
44 lines (41 loc) · 858 Bytes
/
icpcE.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <bits/stdc++.h>
using namespace std;
void solve(string s) {
for (size_t i = 0; i < s.size() - 1; i++) {
if (s[i] == 'M' && s[i + 1] == '?') {
cout << "Yes";
return;
}
}
for (size_t i = 0; i < s.size() - 1; i++) {
if (s[i] == 'M' && s[i + 1] == 'U') {
cout << "Yes";
return;
}
}
for (size_t i = s.size() - 1; i >= 1; i--) {
if (s[i] == 'U' && s[i - 1] == '?') {
cout << "Yes";
return;
}
}
cout << "No";
}
int main() {
int t, total;
cin >> t;
total = t;
while (t--) {
// int size;
// cin >> size;
string s;
cin >> s;
// cout << "Case " << total - t << ": ";
// vector<int> arr(size);
// for (size_t i = 0; i < size; i++)
// cin >> arr[i];
solve(s);
cout << "\n";
};
return 0;
}