As we all know, Chef is cooking string for long days, his new discovery on string is the longest common pattern length. The longest common pattern length between two strings is the maximum number of characters that both strings have in common. Characters are case sensitive, that is, lower case and upper case characters are considered as different. Note that characters can repeat in a string and a character might have one or more occurrence in common between two strings. For example, if Chef has two strings A = "Codechef" and B = "elfedcc", then the longest common pattern length of A and B is 5 (common characters are c, d, e, e, f).
Chef wants to test you with the problem described above. He will give you two strings of Latin alphabets and digits, return him the longest common pattern length.

-----Input-----
The first line of the input contains an integer T, denoting the number of test cases. Then the description of T test cases follows.
The first line of each test case contains a string A. The next line contains another character string B.

-----Output-----
For each test case, output a single line containing a single integer, the longest common pattern length between A and B.

-----Constraints-----
- 1 ≤ T ≤ 100
- 1 ≤ |A|, |B| ≤ 10000 (104), where |S| denotes the length of the string S
- Both of A and B can contain only alphabet characters (both lower and upper case) and digits

-----Example-----
Input:
4
abcd
xyz
abcd
bcda
aabc
acaa
Codechef
elfedcc

Output:
0
4
3
5

-----Explanation-----
Example case 1. There is no common character.
Example case 2. All the characters are same.
Example case 3. Three characters (a, a and c) are same.
Example case 4. This sample is mentioned by the statement.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 't = int(input())\r\nans = []\r\nwhile t > 0:\r\n    dic_a = {}\r\n    dic_b = {}\r\n    a = input()\r\n    b = input()\r\n    common = 0\r\n    for letter in a:\r\n        if letter in dic_a:\r\n            dic_a[letter]+=1\r\n        else:\r\n            dic_a[letter]=1\r\n    for letter in b:\r\n        if letter in dic_b:\r\n            dic_b[letter]+=1\r\n        else:\r\n            dic_b[letter]=1\r\n    if len(a) > len(b):\r\n        for key in dic_a:\r\n            if key in dic_b:\r\n                common+=min(dic_a[key],dic_b[key])\r\n    else:\r\n        for key in dic_b:\r\n            if key in dic_a:\r\n                common+=min(dic_a[key],dic_b[key])\r\n    ans.append(common)\r\n    t-=1\r\nfor an in ans:\r\n    print(an)\r\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13251