Problem 3802 --Singing Superstar

3802: Singing Superstar

"
Time Limit $2$ 秒/Second(s) Memory Limit $128$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 字符串
Ke Ke is a cheerful, enthusiastic girl. She dreams of singing happily every day. One day, while practicing singing, Ke Ke accidentally discovered that there are some words that can make the song better. She called these words "SuperstarWords". 

After a lot of attempts, she found that in each song, there are a total of n "SuperstarWords". She wants to know the maximum number of disjoint occurrences of each "SuperstarWords" in her song.

Note : one occurrence means that the SuperstarWord is a continuous substring of the song at a certain position.

For example: The maximum number of disjoint occurrences of "aba" in "abababa" is 2
The first line contains an integer T(T≤5), denoting the number of test cases.

The first line of each test case contains one string s(1≤|s|≤105), denoting a song.

The second line of each test case contains one integer n(1≤n≤105), denoting the number of SuperstarWords

The next n lines contains contains one string ai(1≤ |ai≤30), denoting one SuperstarWords

It is guaranteed that for all test cases, ∑|s|≤4∗105∑|ai|≤4∗105

Note:All input string character sets are lowercase English letters
For each test case, output n lines, each line has one integer, indicating the answer.
2
abababbbaanbanananabanana
3
aba
ababa
nana
nihaoxiexiexiaolongbaozaijian
3
qwer
taihaotinleba
xiexi
2
1
2
0
0
1

推荐代码 查看3802 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛