编程介的小学生 2017-11-06 08:08 采纳率: 20.5%
浏览 301
已结题

Jinkeloid

Problem Description
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 c1, c2, ..., ck,and I wonder how many consecutive substring of string s that each ci has occur even times in it.
Two substring with the same content but different position are considered different.

Input
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 <= 105),the second line contains a number Q (Q<= 3 * 104),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 c1, c2, ..., ck(There won't be duplicated ci).

Output
For each query,print the answer in one line.

Sample Input
1
cacca
5
3 c a b
2 c b
2 a b
3 c b a
2 a b

Sample Output
2
7
6
2
6

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 有没有帮写代码做实验仿真的
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥30 vmware exsi重置后登不上
    • ¥15 易盾点选的cb参数怎么解啊
    • ¥15 MATLAB运行显示错误,如何解决?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题