"
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t–){
string s,p;
cin>>s>>p;
int n=s.size();
int l=0,r=0;
int cnt=0;
while(l<=r&& r<n){
while(l<n&&s[l]==p[l])
l++;
r=l+1;
while(r<n&&s[r]==p[r])
r++;
if(l==n)
continue;
else if( r==n ){
cnt++;
}else{
if( (r-l+1) < 4){
cnt+=r-l+1;
}else
cnt+=4;
}
r++;
l=r;
}
cout<<cnt<<endl;
}
// your code goes here
return 0;
}
"