作业帮 > 综合 > 作业

多少个BubbleTime Limit:30000MS Memory Limit:65536K题型:编程题 语言:C语言

来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/05/12 03:13:57
多少个Bubble
Time Limit:30000MS Memory Limit:65536K
题型:编程题 语言:C语言
Description
读入一行字符串(不多于800个字符,以回车结束),统计其中Bubble出现了多少次
Sample Input
Bubble if only Bubble.
Sample Output
2
不要用C++,要C
多少个BubbleTime Limit:30000MS Memory Limit:65536K题型:编程题 语言:C语言
#include
#include
int main()
{
int i;
int len;
int c;
char szInput[801];
gets(szInput);
len = strlen(szInput) - 5;
c = 0;
for (i = 0; i < len; i++)
{
if (!memcmp(szInput + i,"Bubble",6)) c++;
}
printf("%d\n",c);
return 0;
}