这也是道简单的模拟题。
#include <stdio.h>
#include <string.h>
#define mem(a) memset(a, 0, sizeof(a))
char ch[2005], e[4] = {"end"};
bool check(char a)
{
if(a == 'i'||a == 'e'||a == 'a'||a == 'o'||a == 'u')
return true;
return false;
}
int main(int argc, char *argv[])
{
int i, yu, fyu, len, flag, fl;
char c;
for(;;)
{
fl = 0;
flag = 0;
yu = 0;
fyu = 0;
mem(ch);
gets(ch);
if(strcmp(ch, e) == 0)
break;
len = strlen(ch);
c = ch[0];
if(check(c))
yu++, flag = 1;
else
fyu++;
for(i = 1;i < len;i++)
{
if(check(ch[i]))
{
flag = 1;
yu++;
fyu = 0;
}
else
{
yu = 0;
fyu++;
}
if(yu == 3||fyu == 3||(c == ch[i]&&c != 'e'&&c != 'o'))
{
fl = 1;
break;
}
c = ch[i];
}
if(!fl&&flag)
printf("<%s> is acceptable.\n", ch);
else
printf("<%s> is not acceptable.\n", ch);
}
return 0;
}