#Lutece1974. 寻找最短的字符串
寻找最短的字符串
Migrated from Lutece 1974 寻找最短的字符串
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
给你一个字符串,然后再给你个询问,第个询问给你一个数字和一个字符串
这个询问的答案是的最小长度,其中是的子串,且中必须出现个
Input
第一行一个字符串
第二行数字,代表询问次数
后面每一行一个和,代表依次询问
数据保证所有字母均为小写字母
所有询问长度加起来小于
保证所有字符串不相同
Output
行,每行代表一个询问的答案
无解请输出
Samples
aaaaa
5
3 a
3 aa
2 aaa
3 aaaa
1 aaaaa
3
4
4
-1
5
abbb
7
4 b
1 ab
3 bb
1 abb
2 bbb
1 a
2 abbb
-1
2
-1
3
-1
1
-1
Resources
2018 UESTC ACM Training for Search Algorithm and String