Skip to content

Commit a32ccad

Browse files
committed
Added 1800A - Is It a Cat?.cpp
1 parent 7643459 commit a32ccad

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

1800A - Is It a Cat.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
// Code Written By: Vikash Patel
5+
6+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
7+
8+
bool checkMeow( string s, int n)
9+
{
10+
transform(s.begin(),s.end(),s.begin(), ::tolower);
11+
int m,e,o,w;
12+
m=e=o=w=0;
13+
for(int i=0;i<n;i++)
14+
{
15+
if(s[i]=='m')
16+
m++;
17+
else
18+
break;
19+
}
20+
for(int i=m;i<n;i++)
21+
{
22+
if(s[i]=='e')
23+
e++;
24+
else
25+
break;
26+
}
27+
for(int i=m+e;i<n;i++)
28+
{
29+
if(s[i]=='o')
30+
o++;
31+
else
32+
break;
33+
}
34+
for(int i=m+e+o;i<n;i++)
35+
{
36+
if(s[i]=='w')
37+
w++;
38+
else
39+
break;
40+
}
41+
if(m+e+o+w==n && m>0 && e>0 && o>0 && w>0)
42+
return true;
43+
else
44+
return false;
45+
}
46+
47+
int main()
48+
{
49+
int t;
50+
cin>>t;
51+
while(t--)
52+
{
53+
int n;
54+
cin>>n;
55+
string s;
56+
cin>>s;
57+
if(checkMeow(s,n))
58+
cout<<"YES"<<endl;
59+
else
60+
cout<<"NO"<<endl;
61+
}
62+
}
63+

0 commit comments

Comments
 (0)