Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
水好深啊!#include <stdio.h> #include <string.h> int main() { char str[100]; int index,length,i,j,count,flag; while(scanf("%s",str)!=EOF) { if(strcmp(str,"end")==0) break; count=0; flag=0; length=strlen(str); for(index=0;index<length;index++) if(str[index]=='a'||str[index]=='e'||str[index]=='i'||str[index]=='o'||str[index]=='u') count++; if(count<1) { printf("<%s> is not acceptable.\n",str); continue; } for(index=0;index<length-2;index++) if( ( (str[index]=='a'||str[index]=='e'||str[index]=='i'||str[index]=='o'||str[index]=='u')&& (str[index+1]=='a'||str[index+1]=='e'||str[index+1]=='i'||str[index+1]=='o'||str[index+1]=='u')&& (str[index+2]=='a'||str[index+2]=='e'||str[index+2]=='i'||str[index+2]=='o'||str[index+2]=='u') ) || ( (str[index]!='a'&&str[index]!='e'&&str[index]!='i'&&str[index]!='o'&&str[index]!='u')&& (str[index+1]!='a'&&str[index+1]!='e'&&str[index+1]!='i'&&str[index+1]!='o'&&str[index+1]!='u')&& (str[index+2]!='a'&&str[index+2]!='e'&&str[index+2]!='i'&&str[index+2]!='o'&&str[index+2]!='u') ) ) flag=1; if(flag) { printf("<%s> is not acceptable.\n",str); continue; } flag=0; for(index=0;index<length-1;index++) if(str[index]==str[index+1]&&str[index]!='o'&&str[index]!='e') flag=1; if(flag) { printf("<%s> is not acceptable.\n",str); continue; } printf("<%s> is acceptable.\n",str); } return 1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator