#C1095. Count Anagram Substrings
Count Anagram Substrings
Count Anagram Substrings
Given two strings S and P, your task is to count the number of substrings in S that are anagrams of P.
An anagram is a rearrangement of the characters. In other words, two strings are anagrams if they contain the same characters with the same frequencies (order does not matter).
A substring is a contiguous block of characters within a string.
You will be given T test cases. For each test case, output the number of substrings in S that are anagrams of P.
inputFormat
The first line contains an integer T, the number of test cases. Each of the following T lines contains two space-separated strings S and P.
outputFormat
For each test case, output a single line containing the number of substrings in S that are anagrams of P.## sample
3
cbaebabacd abc
abab ab
abcd abcde
2
3
0
</p>