## 程序设计在线评测（Online Judge）

2017年湖南科技大学大学生计算机程序设计竞赛即将于12月举行！

[提交][状态][讨论版]

## 题目描述

There are many Forbidden Words(FW) in internet searching. Now I have the FW list and a passage, I want to find the longest substring that contain none FW.

## 输入

The first line contains an integer T (T<=100) indicating the number of test cases.

For each test case, the first line contain two integers n , m(0 < n <= 100000 , 0 <= m <= 1000)indicating the length of the passage and the number of the FW.

The next line contain the passage.

The next n line each contain a FW, the length of the FW not exceed 100.

The passage and the FW only contain capital letter.

## 输出

Output the length of the longest substring that contain none FW.

## 样例输入

2
39 3
IDONTNEEDSEXTHEGOVERMENTFUCKSMEEVERYDAY
SEX
GOVERMENT
FUCK
10 1
AAAAAAAAAA
AAA


## 样例输出

14
2


[提交][状态][讨论版]