The Known-Plaintext Attack
--------------------------

A classical (but insecure) method of encrypting text is to permute the
letters of the alphabet.  That is, in the text, each letter of the
alphabet is consistently replaced by some other letter.  To ensure
that the encryption is reversible, no two letters are replaced by the
same letter.  Spaces between words are not changed during encryption.

Alice uses this method to send coded messages to Bob by radio
transmissions.  Since they know the method is not very secure, they
use a different permutation each day.  (They have agreed upon the
permutations to use in advance.)  This means that Eve, who is
intercepting the radio messages, has to figure out the new permutation
each morning before she can start decoding the intercepted messages. 

If Alice starts her message to Bob each morning with the same opening,
then Eve can use this fact to gain a lot of information about today's
permutation.  For example, if every message starts with "Dear Bob,
...", then Eve can immediately see (from the encoded message) which
letters are used to encode the letters a, b, d, e and o.  (This type
of codebreaking is called a "known-plaintext attack" on a cryptosystem.
The British used this kind of analysis during World War II to help
figure out the key to the German Enigma cryptosystem, which was
changed daily.  Somebody noticed that the Germans sent an encrypted
weather bulletin, containing the German word "Wetter", at the same
time each morning.)

Suppose you are given two encrypted messages that were intercepted on
different days.  Your task is to compute the length of the longest
possible prefix of the two strings that could possibly be encodings of
the same string. 

Input
-----

The first line of input will be a natural number $n \geq 1$, giving
the number of pairs of strings to be analyzed.  Each pair will consist
of two lines of text, containing (only) lower-case letters and spaces.
(There will be no spaces at the end of the line.)  The length of each
line will be at most 200 characters.

Output
------

For each instance, output the length of the longest possible prefix.
Each output should appear on a separate line. 

Sample Input
------------

3
zyx wvvux ttsrq
abc deefc ghijk
si hoc legere scis nimium eruditionis habes
if you know how to read this you are overeducated
im looking over a four leaf clover
that i overlooked before

Sample Output
-------------

11
9
2