#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define ll long long
void solve(){
string s1,s2;cin>>s1>>s2;
map<int,int>freq1,freq2;int ans=(int)s1.size();
for(int i=0;i<(int)s1.size();i++){freq1[s1[i]-'a']++;}
for(int i=0;i<(int)s2.size();i++){freq2[s2[i]-'a']++;}
for(int i=0;i<26;i++){if(freq2[i]>freq1[i]){ans+=freq2[i]-freq1[i];}}
cout<<ans<<endl;
}
int main() {
int t;
cin>>t;
while(t--)solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKCnZvaWQgc29sdmUoKXsKc3RyaW5nIHMxLHMyO2Npbj4+czE+PnMyOwptYXA8aW50LGludD5mcmVxMSxmcmVxMjtpbnQgYW5zPShpbnQpczEuc2l6ZSgpOwpmb3IoaW50IGk9MDtpPChpbnQpczEuc2l6ZSgpO2krKyl7ZnJlcTFbczFbaV0tJ2EnXSsrO30KZm9yKGludCBpPTA7aTwoaW50KXMyLnNpemUoKTtpKyspe2ZyZXEyW3MyW2ldLSdhJ10rKzt9CmZvcihpbnQgaT0wO2k8MjY7aSsrKXtpZihmcmVxMltpXT5mcmVxMVtpXSl7YW5zKz1mcmVxMltpXS1mcmVxMVtpXTt9fQogICAgY291dDw8YW5zPDxlbmRsOwp9CmludCBtYWluKCkgewoJaW50IHQ7CgljaW4+PnQ7Cgl3aGlsZSh0LS0pc29sdmUoKTsKCXJldHVybiAwOwp9