Problem G. Good Article Good sentence
时间限制 3000 ms
内存限制 32 MB
In middle school, teachers used to encourage us to pick up pretty sentences so that we could apply those sentences in our own articles. One of my classmates ZengXiao Xian, wanted to get sentences which are different from that of others, because he thought the distinct pretty sentences might benefit him a lot to get a high score in his article.
Assume that all of the sentences came from some articles. ZengXiao Xian intended to pick from Article A. The number of his classmates is n. The i-th classmate picked from Article Bi. Now ZengXiao Xian wants to know how many different sentences she could pick from Article A which don't belong to either of her classmates?Article. To simplify the problem, ZengXiao Xian wants to know how many different strings, which is the substring of string A, but is not substring of either of string Bi. Of course, you will help him, won't you?
输入数据
输出数据
For each case, print the case number and the number of substrings that ZengXiao Xian can find.
样例输入
复制
3
2
abab
ab
ba
1
aaa
bbb
2
aaaa
aa
aaa
样例输出
复制
Case 1: 3
Case 2: 3
Case 3: 1
$ Mathjax font initiator $