#P8835. [传智杯 #3 决赛] 子串
[传智杯 #3 决赛] 子串
Background
disangan233 likes strings, so disangan333 wants you to find some strings that disangan233 likes.
Problem Description
In ChuanZhi’s development class, you are expected to develop a document processing software.
Given queries, each query provides strings of lengths consisting only of English letters. Find the number of occurrences of in , where uppercase and lowercase of the same letter are not distinguished. Note that is a contiguous subsequence (substring) of .
For all testdata, , . The strings consist only of uppercase or lowercase English letters.
Input Format
The input has a total of lines.
Line contains positive integer .
Then there are groups of input, each group has lines.
Line contains positive integers .
Line contains a string of length .
Line contains a string of length .
Output Format
Output lines. Line outputs integer, indicating the answer to query .
5
3 10
abc
abcabcabca
2 10
aa
AAaAaaAaAa
5 5
AbCdE
eDcBa
5 5
abcde
ABCDE
3 10
aba
ABaBaAbaBA
3
9
0
1
4
Hint
For the first group of input, it appears times, namely [abc]abcabca, abc[abc]abca, abcabc[abc]a.
For the second group of input, it appears times, namely [Aa]AaaAaAa, A[aA]aaAaAa, Aa[Aa]aAaAa, AaA[aa]AaAa, AaAa[aA]aAa, AaAaa[Aa]Aa, AaAaaA[aA]a, AaAaaA[aA]a, AaAaaAa[Aa].
Translated by ChatGPT 5