You are given two strings a and b. Find the longest common prefix between them after performing zero or more operation on string b. In each operation you can swap any two letters.
The first line of the input contains an integer T (1 ≤ T ≤ 500), where T is the number of the test cases.
Each case has one line that contains two space separated strings a and b.
All strings are non-empty consisting of lowercase English letters only. The length of each of these strings does not exceed 105 characters.
Print T lines, each line contains a single integer that represents the length of the longest common prefix between a and b.
3
hello hey
here there
you me
2
4
0
Name |
---|