#include<iostream> #include<string> using namespace std; int main() { string s; while(cin>>s) { if(s=="end") break; //条件一 if(s.find("a")>s.size()&&s.find("e")>s.size()&&s.find("i")>s.size()&&s.find("o")>s.size()&&s.find("u")>s.size()) { cout<<"<"<<s<<">"<<" is not acceptable."<<endl; continue; } // 条件二 int a=0,b=0,t; for(int i=0;i<s.size();i++) { if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u') { if(i==0) a=1; else { if(s[i-1]=='a'||s[i-1]=='e'||s[i-1]=='i'||s[i-1]=='o'||s[i-1]=='u') a++,b=0; else a=1,b=0;//没有考虑这种情况 } } else { if(i==0) b=1; else { if(s[i-1]!='a'||s[i-1]!='e'||s[i-1]!='i'||s[i-1]!='o'||s[i-1]!='u') b++,a=0; else a=0,b=1;//没有考虑这种情况 } } if(a==3||b==3) { // printf("a=%d b=%d/n",a,b); cout<<"<"<<s<<">"<<" is not acceptable."<<endl; goto RL; } } //条件三 t=0;//int t=0 显示错误 for(int i=0;i<s.size();i++) { if(i==0) t=1; else { if(s[i]=='e'||s[i]=='o') t=0; if(s[i]==s[i-1]) t++; else t=1;// } if(t==2) { cout<<"<"<<s<<">"<<" is not acceptable."<<endl; goto RL; } } cout<<"<"<<s<<">"<<" is acceptable."<<endl; RL: continue; } system("pause"); return 0; } http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=698