After listening several songs of Jinkeloid,I come up with this problem :).
There is a string s only consist of first 20 lowercase English letters.
And we have several queries,each time I have k letters c
1, c
2, ..., c
k,and I wonder how many consecutive substring of string s that each c
i has occur even times in it.
Two substring with the same content but different position are considered different.
The first line contains integer T(1<=T<=5),denote the number of the test cases.
For each test cases,the first line contains a string s(1<= length of s <= 10
5),the second line contains a number Q (Q<= 3 * 10
4),denote the number of queries.
Then Q lines follows,each lines start with a number k(1<= k<= 5),then contains k lowercase English letters c
1, c
2, ..., c
k(There won't be duplicated c
i).
For each query,print the answer in one line.