POJ 1126
#include <stdio.h> #include <string> #include <iostream> using namespace std; int main() { // freopen("acm.acm","r",stdin); // freopen("out.acm","w",stdout); string s; int len; int i; int index; while(cin>>s) { index = 0; len = s.length(); for(i = len - 1; i >= 0; -- i) { if(s[i] >= 'p' && s[i] <= 'z') { ++ index; } else if(s[i] == 'C' || s[i] == 'D' || s[i] == 'E' || s[i] == 'I') { if(index >= 2) { -- index; } else { index = 0; break; } } else if(s[i] == 'N') { if(index == 0) { break; } } else { index = 0; break; } } if(index == 1) { cout<<"YES"<<endl; } else { cout<<"NO"<<endl; } } return 0; }
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。
技术网站地址: vmfor.com