#K60957. Taco Button Transformation

    ID: 31201 Type: Default 1000ms 256MiB

Taco Button Transformation

Taco Button Transformation

You are given an initial sequence of characters and a final sequence of characters. You need to determine the minimum number of button presses required to transform the initial sequence into the final sequence.

The transformation is done by either appending additional characters at the end or replacing some of the characters after the longest common prefix between the two sequences. In other words, if the longest common prefix has a length of \(p\), and the lengths of the initial and final strings are \(|s|\) and \(|f|\) respectively, then the minimum number of button presses required is given by:

\(\text{result} = \max(|s|, |f|) - p\)

It is guaranteed that the operations allowed will transform the initial sequence into the final sequence in the minimum number of button presses computed as above.

inputFormat

The first line contains a single integer \(T\) (\(1 \le T \le 10^5\)), representing the number of test cases.

For each test case, there are two subsequent lines:

  • The first line contains the initial sequence.
  • The second line contains the final sequence.

Both sequences consist of lowercase English letters.

outputFormat

For each test case, output a single integer on a new line representing the minimum number of button presses required to transform the initial sequence to the final sequence.

## sample
3
ab
abc
abc
abcd
ab
ac
1

1 1

</p>