/**
  *	 Author: N.Nafi1211 || <nomaannafi99@gmail.com> #~#
**/	

#include <bits/stdc++.h>
using namespace std;

clock_t startTime;
double getCurrentTime(){
	return (double) (clock() - startTime) / CLOCKS_PER_SEC;
}

#define PB push_back

typedef long long ll;
typedef vector<char> vc;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;

void solve()
{
	string a, b;
	cin >> a >> b;
	int n = a.length(), m = b.length();

	int res = 0;

	for(int len=1; len<=min(n, m); ++len) {
		for(int i=0; i+len<=n; ++i) {
			for(int j=0; j+len<=m; ++j) {
				if(a.substr(i, len) == b.substr(j, len)) {
					res = max(res, len);
				}
			}
		}
	}
	int ans = n-res + m-res;
	cout << ans << "\n";
	return;

}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//startTime = clock();

	int t;

	cin >> t;

	while(t--)
		solve();

	//printf("%.3lf\n", getCurrentTime());
	return 0;
}

