9300 - Longest Common Substring (I)   

Description

Given two strings, find the length of the longest common substring.

Input

The first line of input contains a positive integer t (t <= 100), which indicates the number of test cases.  For each case, there are two strings in a line (length of the string <= 1000).

case 1: length of the string <= 30

case 2: length of the string <= 100

case 3: length of the string <= 1000

case 4: length of the string == 1000

Output

Output the length of the longest common substring.

Sample Input  Download

Sample Output  Download

Tags




Discuss