2270501_ac_0ms_60k.c

来自「北大大牛代码 1240道题的原代码 超级权威」· C语言 代码 · 共 30 行

C
30
字号
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main()
{
	int i;
	char str[21], word[21];
	
	while(scanf("%s",str)==1&&strcmp(str,"end")!=0)
	{
		strcpy(word,str);
		if(!strchr(str,'e')&&!strchr(str,'a')&&!strchr(str,'i')&&!strchr(str,'o')&&!strchr(str,'u'))
			goto m1;
		for(i = 1; str[i]!='\0'; i++)
			if(str[i]==str[i-1]&&(str[i]!='e'&&str[i]!='o'))
				goto m1;
		for(i = 0; str[i]!='\0'; i++)
			if(str[i]=='a'||str[i]=='e'||str[i]=='u'||str[i]=='i'||str[i]=='o')
				str[i] = 'a';
			else
				str[i] = 'b';
		if(strstr(str,"aaa")||strstr(str,"bbb"))
			goto m1;
		printf("<%s> is acceptable.\n",word);
		continue;
		m1:printf("<%s> is not acceptable.\n",word);
	}
	return 1;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?