ZOJ 1698 Easier Done Than Said?
来源:互联网 发布:单片机延时程序原理 编辑:程序博客网 时间:2024/06/05 14:39
#include <cstdio>#include <cstring>#include <cstdlib>#include <vector>#include <cmath>#include <iostream>#include <algorithm>#include <functional>#include <string>#include <map>using namespace std;bool isvowels(char c){ if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u') return true; return false;}int main(){ bool r1,r2,r3; char str[100]; while(gets(str)) { if(strcmp(str,"end")==0) break; int len=strlen(str); r1=false; r2=r3=true; for(int i=0;i<len;i++) { if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u') r1=true; if(i+2<len) { if(isvowels(str[i])&&isvowels(str[i+1])&&isvowels(str[i+2])) r2=false; if(!isvowels(str[i])&&!isvowels(str[i+1])&&!isvowels(str[i+2])) r2=false; } if(i+1<len && !(str[i]=='e'||str[i]=='o') ) { if(str[i]==str[i+1]) r3=false; } } if(r1&&r2&&r3) printf("<%s> is acceptable.\n",str); else printf("<%s> is not acceptable.\n",str); } return 0 ;}