合法语句(phrase)
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
给定M(1 <= M <= 1,000)个已知串,再给定N(1 <= N <= 10,000)个待定字符串,对于每个待定字符串,如果它是任意一个已知串的前缀,则该串为合法的。求总有几个合法的串。
Format
Input
输入格式:
第一行为N,M;
接下来的N行为已串,每行一个串;
接下来的M行为待定字符串,每行一个串.
Output
合法串的数量
Samples
3 4
I will not buy this record, it is scratched.
My hovercraft is full of eels.
Do you want to come back to my place? Bouncy, bouncy.
I will not buy this rec
My helicopter is
Do you want to come back
I will not buy this cat.
2
Limitation
1s, 1024KiB for each test case.