Medium Accuracy: 27.26% Submissions: 1818 Points: 4
Manoj, Vinoj and Jegan are the famous coders of TCE. One fine day Vinoj and Jegan challenge Manoj to solve a puzzle. That is Vinoj will select one string A. Similarly Jegan will choose one string B with the same size. You need to help Manoj to find the longest subsequence X of a string A which is a substring Y of a string B.
A : ABCD
B : BACDBDCD
The answer would be 3 as because 'ACD' is the longest subsequence of A which is also a substring of B.
The first line of input contains an integer T. Then T test cases follow. Each test case contains two space separated strings A and B.
For each test case in a new line print the required output.