遇见特定字符串就输出一句话
比如遇见字符串中 遇见子字符串problem, 就输出bluefly。并且不区分大小写。。输入
123problem123124promblem,
输出
bluefly
bluefly
这应该怎么实现。。求解答
#include <stdio.h> int main(void) { char ch, a[] = "problem", b[] = "bluefly", *p = a; while((scanf("%c", &ch)) != EOF && ch != '\n') { if(*p == ch) p++; if(*p == '\0') { puts(b); p = a; } } return 0; }