Given two strings X and Y. The task is to find the length of the longest common substring.
First line of the input contains number of test cases T. Each test case consist of three lines, first of which contains 2 space separated integers N and M denoting the size of string X and Y strings respectively. The next two lines contains the string X and Y.
For each test case print the length of longest common substring of the two strings .
1 <= T <= 200
1 <= N, M <= 100
Testcase 1: CDGH is the longest substring present in both of the strings.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.