hdu 1039 (字串水題)
阿新 • • 發佈:2019-01-26
不滿足的標記,純水
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() { char s[25]; char d[]="aeiou"; while(cin>>s&&strcmp(s,"end")) { int flag=0,f=0,k=0; int key[25]; memset(key,0,sizeof(key)); int len=strlen(s); for(int i=0; i<len; i++) { if(s[i]==s[i+1]&&s[i]!='e'&&s[i]!='o') flag=1; for(int j=0; j<5; j++) { if(s[i]==d[j]) { f=1; key[i]=1; } } } for(int i=0; i<len-2; i++) { if(key[i]==key[i+1]&&key[i+1]==key[i+2]) k=1; } if(!flag&&f&&!k) printf("<%s> is acceptable.\n",s); else printf("<%s> is not acceptable.\n",s); } return 0; }