Description
Time Limit:1000ms Memory Limit:65536KB |
Description |
You are given an dictionary in which there are N words. Also, you are given an article with the length of L and there`s no punctuation. How many way can you translate this article? |
InputThe first line is an integer T which stands for the number of test cases. Then T test cases follow. The first line of a test case contains an integer N (1<=N<=1000). Each of the following N lines contains one word . The length of each word is guaranteed to be less than or eaqul to 1000. The next line contains some characters which describe the article. The characters are lowercase letters. |
OutputFor each case output its answer after mod by 835672545. |
Sample Input2 5 ab cb bc ba a abcba 3 a ba ab ababa |
Sample Output2 3 |
Hint |
Authoronmylove |
SourcePreliminary (Single)先按单词建树。。。dp【i】代表i到n的方案数则 dp【i】=∑ (dp【j】) (i到j是个完整的单词)
|