We define an approximate period similarly. Given two strings x and y, suppose that the string x is partitioned into substrings pi, 1 ≤ i ≤ t, where pi is not a null string, i.e., x = p1 · p2 · p3 · · · pt. If the edit distance between a string y and each substring pi is less than or equal to an integer k, string y is called a k-approximate period of string x.
In this problem, given two strings x and y, we want to find the minimum k such that string y is a k-approximate period of string x. For example, suppose that two strings x = abcdabcabb and y=abc are given. Since x may be partitioned into x = p1 · p2 · p3 = abcd · abc · abb and the edit distances between string y=abc and each substring abcd, abc, and abb equal to 1, 0, and 1, respectively, y is a 1-approximate period of x. Hence, the minimum k is one.
Your program is to read from standard input. The input consists of T test cases. The number of test cases T is given in the first line of the input. For each test case, a string y is given in the first line and the string x is given in the next line. The length of string y is at least 1 and at most 50, the length of string x is at least 1 and at most 5000, and the alphabet Σ is the set of lowercase English characters.
Your program is to write to standard output. Print exactly one line for each test case. Print the minimum integer value k such that string y is a k-approximate period of string x.