题目大意:题目描述了一大堆.....然而并没什么用,其实就是让求给的所有字符串里面有多少个"doge",不区分大小写。
代码如下:
======================================================================================================================
#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; const int MAXN = 1e6+7; const int oo = 1e9+37; char s[MAXN]; int main() { int ans = 0; while(scanf("%s", s) != EOF) { for(int i=0; s[i]; i++) { if(s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a'; } char *p = s; while(p=strstr(p, "doge"), p != NULL) ans++, p+=4; } printf("%d ", ans); return 0; }