-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path00271.cpp
More file actions
47 lines (45 loc) · 1018 Bytes
/
00271.cpp
File metadata and controls
47 lines (45 loc) · 1018 Bytes
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
#include <bits/stdc++.h>
using namespace std;
int main()
{
char input[1024];
while(cin>>input)
{
int len=strlen(input),num(0);
bool ans(true);
for(int i=len-1;i>=0;i--)
{
if(input[i]>='p'&&input[i]<='z')
{
num++;
}
else if(input[i]=='N')
{
if(!num)
{
ans=false;
break;
}
}
else if(input[i]=='I'||input[i]=='C'||input[i]=='D'||input[i]=='E')
{
if(num<2)
{
ans=false;
break;
}
num--;
}
else
{
ans=false;
break;
}
}
if(ans&&num==1)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}