Rules:
1. must contain at least one vowel letter. A E i o u
2. Cannot contain three consecutive vowels or consecutive consonant letters.
3. Cannot contain two consecutive letters, except ' ee ' and ' oo '.
PS: Number of letters (1<= N <=20).
#define_crt_secure_no_deprecate#include<stdio.h>#include<stdlib.h>#include<string.h>intIs_vowel (CharStrin) { if(Strin = ='a'|| Strin = ='e'|| Strin = ='I'|| Strin = ='o'|| Strin = ='u') return 1; Else return 0;}voidMain () { while(1) { Charstrin[ +] = {' /'}; Charstrtemp[ +] = {' /'};//character cache, used to determine whether the same character appears consecutively Chartemp; intCount =0;//statistics consecutive same number of letters intCount2 =0;//count consecutive vowels or consonant letters intVowelflag =0;//is the sign of the vowel bit intLastisvowel =0;//whether the previous letter is a vowel sign bit 0 is not 1 is intSign =0;//whether it contains a vowel marker bit intResultfalg =1; intLen//Save the length of the input stringgets (Strin); Len= (int) strlen (Strin); //decide whether to end the query flag first if(strcmp (Strin,"End") ==0) return; Temp= strin[0]; Count=1; Count2=1; Vowelflag= Is_vowel (strin[0]); Lastisvowel= Is_vowel (strin[0]); //find if a vowel letter is included, if you encounter 3 consecutive vowels, consonant letters or 2 consecutive letters other than ' EE ' oo ', you are judged unacceptable and exit the loop for(inti =0; i < Len; i++) { if(Sign = =0) Sign=Is_vowel (Strin[i]); //If the same letter appears if(I >0&& temp = =Strin[i]) {Count++; if(Count = =2) { if(Temp! ='e'&& Temp! ='o') {Resultfalg=0;//not receive, jump out of the loop Break; } } } //if three consecutive vowels or three consecutive consonants appear if(I >0) {Vowelflag=Is_vowel (Strin[i]); if(Vowelflag = =Lastisvowel) {Count2++; if(Count2 >=3) {Resultfalg=0;//not receive, jump out of the loop Break; } } Else{Count2=1; Lastisvowel=Vowelflag; }} Temp=Strin[i]; Count=1; } if(Sign = =1&& Resultfalg! =0) {printf ("<%s> is acceptable.", Strin); printf ("\ n"); } Else{printf ("<%s> is not acceptable.", Strin); printf ("\ n"); } }}
String HDU 1039