xoj1199

来源:互联网 发布:生日网站源码 编辑:程序博客网 时间:2024/06/06 03:51
#include<stdio.h>#include<string.h>int main(){int t = 0;char a[1000000];char b[1000000];int count = 0;scanf("%d",&t);while(t--){count = 0;int i = 0;int j = 0;scanf("%s",a);scanf("%s",b);while( i <= (strlen(a) - strlen(b)) ){j = 0;while( j < strlen(b) ){if( a[i+j] != b[j] ){break;}j++;}if( j == strlen(b) ){i += j;count++;}else{i++;}}printf("%d\n",count);}return 0;}

#include#includeint main(){int t = 0;char a[1000000];char b[1000000];int count = 0;scanf("%d",&t);while(t--){count = 0;int i = 0;int j = 0;scanf("%s",a);scanf("%s",b);while( i <= (strlen(a) - strlen(b)) ){j = 0;while( j < strlen(b) ){if( a[i+j] != b[j] ){break;}j++;}if( j == strlen(b) ){i += j;count++;}else{i++;}}printf("%d\n",count);}return 0;}
0 0