Problem Description
YB intends to write a powerful text editor, and take a cool pull wind, high-end elegant name, such as "YB brand text editor" and the like. Since it is powerful, there must be a search function. But he had a little problem when he finished the function. Now come and ask for your help.
To give you a text string s and a pattern string t, you need to write a program to find out how many times T has appeared in S.
Input
The first line is a positive integer t, which indicates that there is a total of T-Group test data.
There is a T-group test followed by two rows per set of test data. The first line is the text string s, and the length is not greater than 10000. The second line is the pattern string T, which is not longer than 10. is a string of lowercase letters only.
Output
Each set of tests corresponds to the output of a positive integer answer, indicating how many times K appears in S.
Sample Input
2abababaabaabcabcabc
Sample Output
32
HINT
1#include <stdio.h>2#include <string.h>3 intStrstrcount (Char*STR1,Char*str2)4 {5 Char*str =str1;6Unsignedintc =0;7 8 while(str = strstr (str, str2))! =NULL)9 {TenC++; Onestr++; A } - returnC; - } the - intMain () - { - Chara[10001],b[ One]; + inti,j,c; - intN; + intresult; Ascanf"%d",&n); at while(n--) - { -scanf"%s%s",&a,&b); - { -result=Strstrcount (A, b); -printf"%d\n", result); in } - } to + return 1; -}
Wuhan University of Science and Technology acm:1007: text editor