The shortest common superstring of 2 strings S
1 and S
2 is a string S with the minimum number of characters which contains both S
1 and S
2 as a sequence of consecutive characters. For instance, the shortest common superstring of “alba” and “bacau” is “albacau”.
Given two strings composed of lowercase English characters, find the length of their shortest common superstring.
The first line of input contains an integer number T, representing the number of test cases to follow. Each test case consists of 2 lines. The first of these lines contains the string S
1 and the second line contains the string S
2. Both of these strings contain at least 1 and at most 1.000.000 characters.
For each of the T test cases, in the order given in the input, print one line containing the length of the shortest common superstring.