-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Is_It_a_Cat.cpp
More file actions
62 lines (60 loc) · 1.03 KB
/
A_Is_It_a_Cat.cpp
File metadata and controls
62 lines (60 loc) · 1.03 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
void solve()
{
int n;
cin >> n;
string s;
cin >> s;
set<char> st;
st.insert('m');
st.insert('e');
st.insert('o');
st.insert('w');
for (auto &c : s)
c = tolower(c);
// cout << s << endl;
int m = 0, e = 0, o = 0, w = 0;
int i = 0;
for (; i < n;)
{
if (s[i] == 'm')
m++, i++;
else
break;
}
for (; i < n;)
{
if (s[i] == 'e')
e++, i++;
else
break;
}
for (; i < n;)
{
if (s[i] == 'o')
o++, i++;
else
break;
}
for (; i < n;)
{
if (s[i] == 'w')
w++, i++;
else
break;
}
cout << ((i == n && m && e && o && w && m + e + o + w == n) ? "YES" : "NO") << endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt;
tt = 1;
cin >> tt;
while (tt--)
solve();
return 0;
}