Time Limit: 1 second(s) | Memory Limit: 64 MB |
A string is a finite sequence of symbols that are chosen from an alphabet. In this problem you are given two non-empty strings A and B, both contain lower case English alphabets. You have to find the number of times B occurs as a substring of A.
Input starts with an integer T (≤ 5), denoting the number of test cases.
Each case starts with two lines. First line contains A and second line contains B. You can assume than 1 ≤ length(A), length(B) ≤ 10^{6}.
For each case, print the case number and the number of times B occurs as a substring of A.
Sample Input |
Output for Sample Input |
4 axbyczd abc abcabcabcabc abc aabacbaabbaaz aab aaaaaa aa |
Case 1: 0 Case 2: 4 Case 3: 2 Case 4: 5 |
Dataset is huge, use faster I/O methods.
Developed and Maintained by
JANE ALAM JAN |
Copyright © 2012
LightOJ, Jane Alam Jan |