#P3763. [TJOI2017] DNA
[TJOI2017] DNA
Description
Researchers at the Biology Institute of Garitun University discovered a gene sequence that determines whether a person likes eating lotus root. Any DNA segment with this sequence exhibits the "likes lotus root" trait. Moreover, they found that for the base sequence , modifying at most bases still results in the trait. Now the researchers want to locate this gene on a DNA strand . Therefore, you need to count, on the DNA sequence of a person who exhibits the trait, how many contiguous substrings could be this gene, i.e., how many contiguous substrings of can be changed into by modifying at most three letters.
Input Format
The first line contains an integer , the number of test cases.
For each test case, the first line contains a base sequence of length not exceeding .
The second line contains the "lotus-root gene" sequence of length not exceeding .
Output Format
Output lines. The -th line indicates, in the -th test case, how many contiguous substrings in of the same length as could be a base sequence exhibiting the "likes lotus root" trait.
1
ATCGCCCTA
CTTCA
2
Hint
For of the testdata, the lengths of and do not exceed .
For of the testdata, the lengths of and do not exceed , .
Note: DNA base sequences only contain the four characters A, T, C, and G.
Translated by ChatGPT 5
京公网安备 11011102002149号