Medium

30.33%

Given two strings ‘X’ and ‘Y’, find the length of the longest common substring.

Examples :

```
Input : X = "GeeksforGeeks", y = "GeeksQuiz"
Output : 5
The longest common substring is "Geeks" and is of
length 5.
Input : X = "abcdxyz", y = "xyzabcd"
Output : 4
The longest common substring is "abcd" and is of
length 4.
Input : X = "zxabcdezy", y = "yzabcdezx"
Output : 6
The longest common substring is "abcdez" and is of
length 6.
```

**Input:**

First line of the input contains no of test cases **T**,the **T** test cases follow.

Each test case consist of 2 space separated integers **A** and **B** denoting the size of string **X** and **Y** respectively

The next two lines contains the 2 string **X** and **Y**.

**Output:**

For each test case print the length of longest common substring of the two strings .

**Constraints:**

1<=T<=200

1<=size(X),size(Y)<=100

**Example:**

**Input:**

2

6 6

ABCDGH

ACDGHR

3 2

ABC

AC

**Output:**

4

1