Problem: 2050E - Three Strings
Language: c++17 

Solution 1 (runtime: 93 ms):
// 大きな夢を持ち、ポジティブであり続けましょう
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#ifndef ONLINE_JUDGE
    #include "debug.cpp"
    extern void IO();
#else
    #define out(...) 
#endif
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using omset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define ld long double
#define str string
#define pii pair<int,int>
#define vi vector<int> 
#define vpii vector<pii> 
#define vvi vector<vi>
#define vstr vector<str>
#define si set<int>
#define msi multiset<int>
#define mii map<int,int>
#define mci map<char,int> 
#define mivi map<int,vi>
#define misi map<int,si>
#define mipii map<int,pii> 

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define srt(v) sort(all(v))
#define rsrt(v) sort(rall(v))
#define rvr(v) reverse(all(v))
#define count(a,v) count(all(v),a)
#define acc(v) accumulate(all(v),0LL)
#define sz(v) (int)v.size()
#define mini(v) *min_element(all(v))
#define maxi(v) *max_element(all(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define bk back
#define fr front
#define ff first
#define ss second
#define ins insert 
#define er erase 
#define ON(x) __builtin_popcountll(x)

#define rep(i,a,n) for(int i=a; i<n; i++)  // [a,n)
#define rrep(i,a,n) for(int i=a; i>n; i--) // (n,a]
#define repk(i,a,n,k) for(int i=a; i<n; i+=k)
#define rrepk(i,a,n,k) for(int i=a; i>n; i-=k)

#define in(a) cin>>a
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c 
#define in4(a,b,c,d) cin>>a>>b>>c>>d 

#define rdv(v) for(auto& e:v)cin>>e
#define rdvp(v) for(auto& i:v)cin>>i.ff>>i.ss
#define rdvv(v) for(auto& i:v)for(auto& j:i) cin>>j

#define pr(a) cout<<a<<'\n'
#define prs(a) cout<<a<<' '
#define pr2(a,b) cout<<a<<' '<<b<<'\n'
#define pr3(a,b,c) cout<<a<<' '<<b<<' '<<c<<'\n'
#define prv(v) for(auto& i:v)cout<<i<<' ';cout<<'\n'
#define prvp(v) for(auto& i:v){cout<<i.ff<<' '<<i.ss;cout<<'\n';}
#define prvv(v) for(auto& i:v){for(auto& j:i) cout<<j<<' '; cout<<'\n';}
#define prc(b,x,y) cout<<(b?x:y)<<'\n'
#define prcc(b1,x,b2,y,z) cout<<(b1?x:b2?y:z)<<'\n'
#define yn(b) cout<<(b?"YES":"NO")<<'\n'
#define ret return
#define nl cout<<'\n'

/*********************************************************************************************/

void solve(string DA_RUMA_SAN_GA_KO_RON_DA)
{
    str a,b,c;
    in3(a,b,c);
    int n = sz(a), m = sz(b);
    vvi dp(n+m+1,vi(n+1,1e9));
    dp[0][0] = 0;
    rep(i,1,n+m+1) {
        rep(j,0,n+1) {
            if(j) dp[i][j] = dp[i-1][j-1] + (a[j-1]!=c[i-1]);
            if(i-j>0) dp[i][j] = min(dp[i][j], dp[i-1][j]+(b[i-j-1]!=c[i-1]));
        }
    }
    cout << dp[n+m][n] << '\n';
}

/*********************************************************************************************/
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    IO();
#endif
    int tc=1; cin>>tc;
    while(tc--) solve("");
    return 0;
}

Solution 2 (runtime: 77 ms):
#include "bits/stdc++.h"
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template <typename T, typename V>
void mdebug(map<T,vector<V>>m){
    for(auto x:m){
        cerr << x.F << " : [ " ;
        for(auto c:x.S)
            cerr << c << " ";
        cerr << "]"<<endl ;
    }
}
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
//#ifndef ONLINE_JUDGE
//#ifndef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
//#else
//#define debug(x...)
//#endif
//#pragma GCC optimize "trapv"
#define int long long 
#define ld long double 
#define endl '\n' 
const int mod=1e9+7;
int Power(int Num,int Index){
    int r=1 ;
    for(int i=Index;i>0;i/=2,Num*=Num){
        if(i%2==1){
            r*=Num ;    
        }    
    }    
    return r ;
}
void solve(){
	string a,b,c;cin>>a>>b>>c;
	int n1=a.size();
	int n2=b.size();
	int m=c.size();
	vector<vector<int>>dp(n1+1,vector<int>(n2+1));
	for(int i=0;i<=n1;i++){
		for(int j=0;j<=n2;j++){
			if(i>0||j>0){
				int mn1=1e9,mn2=1e9;
				if(i>0){
					mn1=dp[i-1][j]+1;
					if(c[i+j-1]==a[i-1]){
						mn1=min(dp[i-1][j],dp[i-1][j]+1);
					}
				}
				if(j>0){
					mn2=dp[i][j-1]+1;
					if(c[i+j-1]==b[j-1]){
						mn2=min(dp[i][j-1],dp[i][j-1]+1);
					}
				}
				dp[i][j]=min(mn1,mn2);
			}
		}
	}
	cout << dp[n1][n2] << endl;
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int tc ;
    tc = 1 ;
    cin >> tc ; 
    while(tc--){
        solve() ;
    }
    return 0;
}