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

Code 1:
    #include <numeric>

    #include <complex>

    #include <queue>

    #include <set>

    #include <unordered_set>

    #include <list>

    #include <chrono>

    #include <random>

    #include <iostream>

    #include <algorithm>

    #include <cmath>

    #include <string>

    #include <vector>

    #include <map>

    #include <unordered_map>

    #include <stack>

    #include <iomanip>

    #include <fstream>

    #include <cstring>

    #include <climits>

    #include <bitset> 



    #include <ext/pb_ds/assoc_container.hpp>

    #include <ext/pb_ds/tree_policy.hpp>



    #define fastio() ios::sync_with_stdio(NULL);cin.tie(0);cout.tie(0);



    #define   int long long int  

      using namespace std ; 

    //  using namespace __gnu_pbds; 

    // typedef __gnu_pbds::tree<int, __gnu_pbds::null_type, less<int>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update> ordered_set;

   

    int mod = 998244353; 



    int gcd(int a, int b)

    {

        while (a > 0 && b > 0) {

            if (a > b) {

                a = a % b;

            }

            else {

                b = b % a;

            }

        }

        if (a == 0) {

            return b;

        }

        return a;

    }

    pair<int,int> overLap(pair<int ,int > a , pair<int,int> b )

    {



        int l = max(a.first,  b.first); 

        int r = min(a.second , b.second) ; ; 



    if(l>r)return {-1, -1 }; 



    return {l,r}; 



        



        return {-1, -1 }; 





    }







    int LCM(int a , int b ){

        int ans = (a*b)/(gcd(a,b)) ; 

        return ans ; 

    }

   



   

   



    void print(vector<int> &arr){

        for(auto it : arr){

            cout<<it<<" "; 

        }

        cout<<"\n"; 



    }

    void print(vector<pair<string ,string >> arr){

        for(auto it: arr ){

                cout<<it.first<<" "<<it.second<<"\n"; 

            }

    }



    void print(vector<vector<int>>arr){

        for(auto it :arr){

            for(auto itr : it){

                cout<<itr<<" ";

            }

            cout<<"\n"; 

        }

    }

    void print(vector<vector<char>>arr){

        for(auto it :arr){

            for(auto itr : it){

                cout<<itr<<" ";

            }

            cout<<"\n"; 

        }

    }

    void print(vector<string> &arr){

        for(auto it : arr){

            cout<<it<<"\n"; 

        }

       // cout<<"\n"; 



    }

    void print(vector<pair<int,int>>&mat){

        for(auto itr : mat){

           

                cout<<itr.first<< "--"<<itr.second<< " "<<"\n"; 

             

        }

    }

    void print(unordered_map<int ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    void print(vector<pair<double,int>>&mat){

        for(auto it :mat){

            cout<<it.first<<" "<<it.second<<"\n"; 

        }

    }

    void print(map<int ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    void print(map<string ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    void print(unordered_map<string ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    void print(map<int ,int ,greater<int> > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    

    

   

    int ncr(int n , int r ){

        int  sum = 1;



            for(int i = 1; i <= r; i++){

                sum = sum * (n - r + i) / i;

            }



            return sum ; 

    }

    

   

    

     

    int mex(vector<int>arr){

    map<int,int>mp ; 

    for(auto it : arr){

        mp[it]++ ; 

    }

    vector<int>t ; 

    for(auto  it : mp){

        t.push_back(it.first) ; 

    }

    for(int i =0 ; i<t.size() ; i++){

        if(t[i]!=i){

            return i; 

        }

    }



    return t.size() ; 

    }

   

    



    void print(map<char ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    

    



     

    int power ( int base , int pow , int mod  ){

         

        if(pow==0)

        return 1   ; 



        if(pow==1)

        return  base  ; 



        if(pow%2==0){

            int val = (power(base , pow/2, mod ))%mod; 

            return (val*val)%mod ; 

        }

        return    (base*(power(base , pow-1,mod )%mod)) %mod;    

    }

    



    //  bool compare(vector<int>&a , vector<int>&b ){



    //     if(a[1]==b[1])

    //     {

    //         return a[0]<b[0]; 

    //     }

    //     return a[1]<b[1] ; 

    // }

    void print(map<string , pair<int,char >>mp){

        for(auto it : mp){

            cout<<it.first<<"->"<<"freq-"<<it.second.first<<"char"<<it.second.second<<"\n"; 

        }

    }

    void get_tree(vector<int>arr[], int s , vector<int>&tree, vector<int>&vis ){

        tree.push_back(s); 

        vis[s]= 1 ; 

         

        

        for(auto it : arr[s]){

            if(vis[it]==0){

            

                get_tree(arr, it, tree, vis ); 

            }

        }

    }

    



   

    

    

    







    

    

    

    int  build_segment_tree(vector<int>&tree, vector<int>&arr,int indx ,  int s , int e){

        if(s>e)return INT_MIN; 

        if(s==e){

            tree[indx]=arr[s];



            return tree[indx]; 

        }

        int mid = (s+e)/2 ; 

       int l= build_segment_tree(tree, arr, 2*indx+1, s ,mid ) ; 

       int r= build_segment_tree(tree, arr, 2*indx+2, mid+1, e ) ; 



        tree[indx]=l&r ; 

        return l&r ; 

    }

    int query_segment_tree(vector<int>&tree, vector<int>&arr,int indx ,int s ,int e , int L ,int R ){



        if(s>=L and e<=R){

            return tree[indx]; 

        }

        if(s>R || e<L){

            return (1<<30) -1 ; 

        }

        int mid = (s+e)/2 ; 

        int left =  query_segment_tree(tree, arr, 2*indx+1, s, mid , L ,R ) ; 

        int right=query_segment_tree(tree,arr, 2*indx+2, mid+1 , e , L , R) ;



        // left=left==INT_MIN?0:left ;

        // right=right==INT_MIN?0:right;  



        return left&right; 





    }

   

    

    

    

    

    

    

    

   

    int getsum(int l ,int r ){

        int n = r-l+1 ; 

        return (l+r)*(n)/2 ; 

    }

    

    int SUM(int n) {

        return ((n+1)*(n))/2 ; 

    }

   

    bool overlap(int a, int b ,int c ,int d ){

        //1 2 1 3 

        int mn = max(a, c )  ;

        int mx =min(b,d) ; 

        if(mn>mx)return false ; 

        return true ; 

    }

    void print(queue<vector<int>>q){

        while(!q.empty()){

            auto it = q.front() ;

            q.pop() ;  

            for(auto itr:it){

                cout<<itr<<" "; 

            } 

            



        }

        cout<<"nl\n"; 



    }

    void print(multiset<int>mt){

        for(auto it :mt){

            cout<<it<<" "; 

        }

        cout<<"\n"; 

    }

    

    

    bool isPrime(int n ){

        for(int i =2 ; i*i<=n ; i++){

            if(n%i==0)return true ; 

        }

        return false ; 

    }

    void heapify(vector<int>&arr , int i ){

        // max heap ; 

        int largest  = i ;  

        int l = 2*i+1 ; 

        int r = 2*i+2  ; 

        int n = arr.size() ; 

        if(l<n and arr[l]>arr[i] ){

            largest = l ; 

        }

        if(r<n and arr[r]>arr[largest]){

            largest= r ; 

        }

        if(largest!=i){

            swap(arr[i], arr[largest]); 

            heapify( arr, largest) ; 

        }

    }

    string to_binary(int a ){

    //     std::string binary = std::bitset<8>(128).to_string(); //to binary

    // std::cout<<binary<<"\n";

    // return " "; 

         

        string res = bitset<16>(a).to_string() ; 

        return res ; 

    }

    void print(vector<vector<pair<int,int>>>&adj){

        int cnt =0; 

         for(auto it : adj){

        cout<<cnt<<"->"; 

        cnt++ ; 

        for(auto itr : it){

            cout<<"("<<itr.first<<" "<<itr.second<<")" <<" "; 

        }

        cout<<"\n"; 

       }

    }

    void buildHeap(vector<int>&arr){

        int n = arr.size() ; 

        int internal_nodes  = (n/2)-1 ; 

        for(int i = internal_nodes ; i>=0 ; i-- ){

            heapify(arr, i) ; 

        }

        //print(arr) ; 

    }

    int msb(int a ){

        for(int i =31 ; i>=0 ; i--){

            int mask = 1<<i ; 

            int d = mask&a ; 

            if(d)return i ; 

        }

        return 0 ; 

    }

    int unsetbit(int n, int k){

        return (n & ~(1 << (k)));

    }

    int setbit(int n, int k)

    {

        // kth bit of n is being set by this operation

        return ((1 << k) | n);

    }

    



    





    bool reflectHor(vector<vector<int>>arr, map<vector<vector<int> >,int > &mp){

        for(int i =0 ; i<arr.size() ; i++){

            arr[i][1]=arr[i][1]*(-1) ; 

        }

         if( mp.find(arr)!=mp.end() ){

            return false ; 

         }

         return true ; 

    } 

     bool reflectVer(vector<vector<int>>arr, map<vector<vector<int> >,int > &mp){

        for(int i =0 ; i<arr.size() ; i++){

            arr[i][0]=arr[i][0]*(-1) ; 

        }

         if( mp.find(arr)!=mp.end() ){

            return false ; 

         }

         return true ; 

    } 

    bool isValid(vector<vector<int>>&arr, map<vector<vector<int>>, int > &mp){

        int n = arr.size() ; 

        for(int i =0 ; i<4 ; i++){

            for(int j=0 ; j<n ; j++){

                swap(arr[j][0], arr[j][1]); 

                arr[j][i]=arr[j][1]*(-1) ; 



            }

            if(mp.find(arr)!=mp.end()){

                return false ; 

            }

            // reflect  ; 

            bool bb = reflectHor(arr,mp ) ; 

            if(bb==false)return false ; 

            bb= reflectVer(arr, mp) ; 

            if(bb==false)return false ; 

        }

        return true ; 

    } 

    bool compare1(int a, int b ){

       if(a<b)return true ; 



       return false ; 

    }

    class DSU {

   

        vector<int>parent ; 

        vector<int>rank ; 

    public:

          DSU(int n ){

            parent.resize(n+5) ; 

            rank.resize(n+5,0) ;

            for(int i = 0 ; i<=n ; i++){

                parent[i]=i ; 

            } 

        }

        int findParent(int val ){

            if(val==parent[val])

            return val ; 



            return parent[val]= findParent(parent[val]); 

        }

        void unionByRank(int u , int v ){

            if(rank[u]>rank[v]){

                parent[v]=u ; 

            }

            else if(rank[u]<rank[v]){

                parent[u]=v ; 

            }

            else {

                parent[u]=v ;

                rank[v]++ ;  



            }

        }

    }; 

    void dfs(map<int, set<int>>&mat, vector<int>&vis, int src ){

        vis[src]=1 ; 

        //cout<<src<<" ; "; 

        for(auto ngbr: mat[src]){

            if(vis[ngbr]==0){

                dfs(mat, vis, ngbr) ; 

            }

        }

    }

    int help(map<int,set<int>>&mat, int n , int v){

        vector<vector<int> >arr ;

        for(int i =1 ; i<=n ; i++){

        int a = i;

        if(i==v)continue  ; 

        if(mat.find(i)!=mat.end())

        {

        int b = mat[i].size()  ; 

        arr.push_back({b,a} ) ; 

        }

       

       }

       sort(arr.begin(), arr.end()) ; 

       reverse(arr.begin(),arr.end()) ;

       //print(arr) ;  

       int v1 = arr[0][1] ;



       for(auto it: mat[v1]){

         //cout<<it<<" "<<"erase \n"; 

          mat[it].erase(v1) ; 

       } 

       mat.erase(v1) ; 

       return v1 ; 

    }

    void check(int x =1){

        cout<<x<<" "<<"check\n"; 

    }

    

    int fun(string&a, string&b, string&c , int i, int j , int k1,vector<vector<int>>&dp ){

        int k = i+j ; 

        if(k>=c.size())return 0 ; 

        if(i>=a.size()){

            //

            int cnt =0 ; 

            while(k<c.size()){

                if(c[k]!=b[j]){

                    cnt++ ; 

                }

                k++ ; 

                j++ ; 

            }

            return cnt ; 

        }

        if(j>=b.size()){

            int cnt =0 ; 

            while(k<c.size()){

                if(c[k]!=a[i]){

                    cnt++ ; 

                }

                k++ ; 

                i++ ; 

            }

            return cnt ; 

        }

        if(dp[i][j+i]!=-1)return dp[i][j] ; 



        if(a[i]==b[j] and b[j]==c[k]){

            int op1 = fun(a ,b,c , i+1, j , i+j+1 ,dp) ; 

            int op2 = fun(a, b, c , i, j+1, i+j+1,dp) ; 

            // int op3 = fun(a ,b,c , i+1, j , i+j+1,dp )+1 ; 

            // int op4 = fun(a, b, c , i, j+1, i+j+1,dp)+1 ; 

            return dp[i][j+i]=min({op1,op2}) ;



        }

        else if(a[i]==c[k]){

            int op1 =  fun(a,b,c, i+1, j , i+j+1,dp) ; 

            int op2 = fun(a, b,c ,i, j+1, i+j+1,dp) +1 ; 

            return dp[i][j+i]=min(op1,op2) ; 

        }

        else if(b[j]==c[k]){

            int op1 =  fun(a, b,c,i, j+1, i+j+1,dp ); 

            int op2 = fun(a, b, c, i+1 , j, i+j+1,dp) +1 ; 

            return dp[i][j+i]=min(op1,op2) ; 

        }

        else {

            int op1 = fun(a, b, c, i+1, j , i+j+1,dp) ; 

            int op2 = fun(a,b, c, i, j+1, i+j+1 ,dp); 

            return dp[i][j+i]=min(op1,op2)+1 ; 



        }

        return 0 ; 

    }

    

    void solve()

    {  

      string a , b,c ; 

      cin>>a>>b>>c ; 

      int n = a.size() ; 

      vector<vector<int>>dp(n, vector<int>(n+1+n+1,-1)); 

      int ans = fun(a,b, c, 0 , 0 , 0, dp) ; 

      int res = -2 ; 

      for(int i=0 ; i<2*n+2; i++){

        res = max(res, dp[n-1][i]); 

      }

      cout<<res<<"\n"; 

      //print(dp);  

    }

    signed main()

    {

    # ifndef ONLINE_JUDGE 

    freopen("input.txt", "r", stdin); 

    cout << "Reading from input.txt\n";

    freopen("output.txt", "w", stdout); 



    if (!freopen("input.txt", "r", stdin)) {

        cerr << "Could not open input.txt\n";   

        return 1;

    }



    #endif 



        //fastio()  ;

        int  t;

    cin >> t;

    // t=1 ; 



    for(int it=1;it<=t;it++) {

     

        // if(it==246){

              

        //      int n , m ; 

        //      cin>>n>>m ; 

        //      string s ="" ; 

        //      for(int i =0 ; i<n ; i++){

        //         string a ; 

        //         cin>>a ; 

        //         s+=a ; 

        //         s+='0';

        //      }

        //      vector<int>ans ; 

        //      for(int i = 0 ; i<m ; i++){

        //             int  x ;

        //             cin>>x ; 

        //             ans.push_back(x) ; xv 

        //      }



        //      cout<<s<<" "; 

        //      for(auto it : ans )cout<<it<<"\n"; 

        // }

        // else 

        solve();

    }

    return 0;

    }

Code 2:
    #include <numeric>

    #include <complex>

    #include <queue>

    #include <set>

    #include <unordered_set>

    #include <list>

    #include <chrono>

    #include <random>

    #include <iostream>

    #include <algorithm>

    #include <cmath>

    #include <string>

    #include <vector>

    #include <map>

    #include <unordered_map>

    #include <stack>

    #include <iomanip>

    #include <fstream>

    #include <cstring>

    #include <climits>

    #include <bitset> 



    #include <ext/pb_ds/assoc_container.hpp>

    #include <ext/pb_ds/tree_policy.hpp>



    #define fastio() ios::sync_with_stdio(NULL);cin.tie(0);cout.tie(0);



    #define   int long long int  

      using namespace std ; 

    //  using namespace __gnu_pbds; 

    // typedef __gnu_pbds::tree<int, __gnu_pbds::null_type, less<int>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update> ordered_set;

   

    int mod = 998244353; 



    int gcd(int a, int b)

    {

        while (a > 0 && b > 0) {

            if (a > b) {

                a = a % b;

            }

            else {

                b = b % a;

            }

        }

        if (a == 0) {

            return b;

        }

        return a;

    }

    pair<int,int> overLap(pair<int ,int > a , pair<int,int> b )

    {



        int l = max(a.first,  b.first); 

        int r = min(a.second , b.second) ; ; 



    if(l>r)return {-1, -1 }; 



    return {l,r}; 



        



        return {-1, -1 }; 





    }







    int LCM(int a , int b ){

        int ans = (a*b)/(gcd(a,b)) ; 

        return ans ; 

    }

   



   

   



    void print(vector<int> &arr){

        for(auto it : arr){

            cout<<it<<" "; 

        }

        cout<<"\n"; 



    }

    void print(vector<pair<string ,string >> arr){

        for(auto it: arr ){

                cout<<it.first<<" "<<it.second<<"\n"; 

            }

    }



    void print(vector<vector<int>>arr){

        for(auto it :arr){

            for(auto itr : it){

                cout<<itr<<" ";

            }

            cout<<"\n"; 

        }

    }

    void print(vector<vector<char>>arr){

        for(auto it :arr){

            for(auto itr : it){

                cout<<itr<<" ";

            }

            cout<<"\n"; 

        }

    }

    void print(vector<string> &arr){

        for(auto it : arr){

            cout<<it<<"\n"; 

        }

       // cout<<"\n"; 



    }

    void print(vector<pair<int,int>>&mat){

        for(auto itr : mat){

           

                cout<<itr.first<< "--"<<itr.second<< " "<<"\n"; 

             

        }

    }

    void print(unordered_map<int ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    void print(vector<pair<double,int>>&mat){

        for(auto it :mat){

            cout<<it.first<<" "<<it.second<<"\n"; 

        }

    }

    void print(map<int ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    void print(map<string ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    void print(unordered_map<string ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    void print(map<int ,int ,greater<int> > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    

    

   

    int ncr(int n , int r ){

        int  sum = 1;



            for(int i = 1; i <= r; i++){

                sum = sum * (n - r + i) / i;

            }



            return sum ; 

    }

    

   

    

     

    int mex(vector<int>arr){

    map<int,int>mp ; 

    for(auto it : arr){

        mp[it]++ ; 

    }

    vector<int>t ; 

    for(auto  it : mp){

        t.push_back(it.first) ; 

    }

    for(int i =0 ; i<t.size() ; i++){

        if(t[i]!=i){

            return i; 

        }

    }



    return t.size() ; 

    }

   

    



    void print(map<char ,int > m ){

        for(auto it : m ){

            cout<<it.first<<"->"<<it.second<<" "; 

        }

        cout<<"\n" ; 

    }

    

    



     

    int power ( int base , int pow , int mod  ){

         

        if(pow==0)

        return 1   ; 



        if(pow==1)

        return  base  ; 



        if(pow%2==0){

            int val = (power(base , pow/2, mod ))%mod; 

            return (val*val)%mod ; 

        }

        return    (base*(power(base , pow-1,mod )%mod)) %mod;    

    }

    



    //  bool compare(vector<int>&a , vector<int>&b ){



    //     if(a[1]==b[1])

    //     {

    //         return a[0]<b[0]; 

    //     }

    //     return a[1]<b[1] ; 

    // }

    void print(map<string , pair<int,char >>mp){

        for(auto it : mp){

            cout<<it.first<<"->"<<"freq-"<<it.second.first<<"char"<<it.second.second<<"\n"; 

        }

    }

    void get_tree(vector<int>arr[], int s , vector<int>&tree, vector<int>&vis ){

        tree.push_back(s); 

        vis[s]= 1 ; 

         

        

        for(auto it : arr[s]){

            if(vis[it]==0){

            

                get_tree(arr, it, tree, vis ); 

            }

        }

    }

    



   

    

    

    







    

    

    

    int  build_segment_tree(vector<int>&tree, vector<int>&arr,int indx ,  int s , int e){

        if(s>e)return INT_MIN; 

        if(s==e){

            tree[indx]=arr[s];



            return tree[indx]; 

        }

        int mid = (s+e)/2 ; 

       int l= build_segment_tree(tree, arr, 2*indx+1, s ,mid ) ; 

       int r= build_segment_tree(tree, arr, 2*indx+2, mid+1, e ) ; 



        tree[indx]=l&r ; 

        return l&r ; 

    }

    int query_segment_tree(vector<int>&tree, vector<int>&arr,int indx ,int s ,int e , int L ,int R ){



        if(s>=L and e<=R){

            return tree[indx]; 

        }

        if(s>R || e<L){

            return (1<<30) -1 ; 

        }

        int mid = (s+e)/2 ; 

        int left =  query_segment_tree(tree, arr, 2*indx+1, s, mid , L ,R ) ; 

        int right=query_segment_tree(tree,arr, 2*indx+2, mid+1 , e , L , R) ;



        // left=left==INT_MIN?0:left ;

        // right=right==INT_MIN?0:right;  



        return left&right; 





    }

   

    

    

    

    

    

    

    

   

    int getsum(int l ,int r ){

        int n = r-l+1 ; 

        return (l+r)*(n)/2 ; 

    }

    

    int SUM(int n) {

        return ((n+1)*(n))/2 ; 

    }

   

    bool overlap(int a, int b ,int c ,int d ){

        //1 2 1 3 

        int mn = max(a, c )  ;

        int mx =min(b,d) ; 

        if(mn>mx)return false ; 

        return true ; 

    }

    void print(queue<vector<int>>q){

        while(!q.empty()){

            auto it = q.front() ;

            q.pop() ;  

            for(auto itr:it){

                cout<<itr<<" "; 

            } 

            



        }

        cout<<"nl\n"; 



    }

    void print(multiset<int>mt){

        for(auto it :mt){

            cout<<it<<" "; 

        }

        cout<<"\n"; 

    }

    

    

    bool isPrime(int n ){

        for(int i =2 ; i*i<=n ; i++){

            if(n%i==0)return true ; 

        }

        return false ; 

    }

    void heapify(vector<int>&arr , int i ){

        // max heap ; 

        int largest  = i ;  

        int l = 2*i+1 ; 

        int r = 2*i+2  ; 

        int n = arr.size() ; 

        if(l<n and arr[l]>arr[i] ){

            largest = l ; 

        }

        if(r<n and arr[r]>arr[largest]){

            largest= r ; 

        }

        if(largest!=i){

            swap(arr[i], arr[largest]); 

            heapify( arr, largest) ; 

        }

    }

    string to_binary(int a ){

    //     std::string binary = std::bitset<8>(128).to_string(); //to binary

    // std::cout<<binary<<"\n";

    // return " "; 

         

        string res = bitset<16>(a).to_string() ; 

        return res ; 

    }

    void print(vector<vector<pair<int,int>>>&adj){

        int cnt =0; 

         for(auto it : adj){

        cout<<cnt<<"->"; 

        cnt++ ; 

        for(auto itr : it){

            cout<<"("<<itr.first<<" "<<itr.second<<")" <<" "; 

        }

        cout<<"\n"; 

       }

    }

    void buildHeap(vector<int>&arr){

        int n = arr.size() ; 

        int internal_nodes  = (n/2)-1 ; 

        for(int i = internal_nodes ; i>=0 ; i-- ){

            heapify(arr, i) ; 

        }

        //print(arr) ; 

    }

    int msb(int a ){

        for(int i =31 ; i>=0 ; i--){

            int mask = 1<<i ; 

            int d = mask&a ; 

            if(d)return i ; 

        }

        return 0 ; 

    }

    int unsetbit(int n, int k){

        return (n & ~(1 << (k)));

    }

    int setbit(int n, int k)

    {

        // kth bit of n is being set by this operation

        return ((1 << k) | n);

    }

    



    





    bool reflectHor(vector<vector<int>>arr, map<vector<vector<int> >,int > &mp){

        for(int i =0 ; i<arr.size() ; i++){

            arr[i][1]=arr[i][1]*(-1) ; 

        }

         if( mp.find(arr)!=mp.end() ){

            return false ; 

         }

         return true ; 

    } 

     bool reflectVer(vector<vector<int>>arr, map<vector<vector<int> >,int > &mp){

        for(int i =0 ; i<arr.size() ; i++){

            arr[i][0]=arr[i][0]*(-1) ; 

        }

         if( mp.find(arr)!=mp.end() ){

            return false ; 

         }

         return true ; 

    } 

    bool isValid(vector<vector<int>>&arr, map<vector<vector<int>>, int > &mp){

        int n = arr.size() ; 

        for(int i =0 ; i<4 ; i++){

            for(int j=0 ; j<n ; j++){

                swap(arr[j][0], arr[j][1]); 

                arr[j][i]=arr[j][1]*(-1) ; 



            }

            if(mp.find(arr)!=mp.end()){

                return false ; 

            }

            // reflect  ; 

            bool bb = reflectHor(arr,mp ) ; 

            if(bb==false)return false ; 

            bb= reflectVer(arr, mp) ; 

            if(bb==false)return false ; 

        }

        return true ; 

    } 

    bool compare1(int a, int b ){

       if(a<b)return true ; 



       return false ; 

    }

    class DSU {

   

        vector<int>parent ; 

        vector<int>rank ; 

    public:

          DSU(int n ){

            parent.resize(n+5) ; 

            rank.resize(n+5,0) ;

            for(int i = 0 ; i<=n ; i++){

                parent[i]=i ; 

            } 

        }

        int findParent(int val ){

            if(val==parent[val])

            return val ; 



            return parent[val]= findParent(parent[val]); 

        }

        void unionByRank(int u , int v ){

            if(rank[u]>rank[v]){

                parent[v]=u ; 

            }

            else if(rank[u]<rank[v]){

                parent[u]=v ; 

            }

            else {

                parent[u]=v ;

                rank[v]++ ;  



            }

        }

    }; 

    void dfs(map<int, set<int>>&mat, vector<int>&vis, int src ){

        vis[src]=1 ; 

        //cout<<src<<" ; "; 

        for(auto ngbr: mat[src]){

            if(vis[ngbr]==0){

                dfs(mat, vis, ngbr) ; 

            }

        }

    }

    int help(map<int,set<int>>&mat, int n , int v){

        vector<vector<int> >arr ;

        for(int i =1 ; i<=n ; i++){

        int a = i;

        if(i==v)continue  ; 

        if(mat.find(i)!=mat.end())

        {

        int b = mat[i].size()  ; 

        arr.push_back({b,a} ) ; 

        }

       

       }

       sort(arr.begin(), arr.end()) ; 

       reverse(arr.begin(),arr.end()) ;

       //print(arr) ;  

       int v1 = arr[0][1] ;



       for(auto it: mat[v1]){

         //cout<<it<<" "<<"erase \n"; 

          mat[it].erase(v1) ; 

       } 

       mat.erase(v1) ; 

       return v1 ; 

    }

    void check(int x =1){

        cout<<x<<" "<<"check\n"; 

    }

    

    int fun(string&a, string&b, string&c , int i, int j , int k1,vector<vector<int>>&dp ){

        int k = i+j ; 

        if(k>=c.size())return 0 ; 

        if(i>=a.size()){

            //

            int cnt =0 ; 

            while(k<c.size()){

                if(c[k]!=b[j]){

                    cnt++ ; 

                }

                k++ ; 

                j++ ; 

            }

            return cnt ; 

        }

        if(j>=b.size()){

            int cnt =0 ; 

            while(k<c.size()){

                if(c[k]!=a[i]){

                    cnt++ ; 

                }

                k++ ; 

                i++ ; 

            }

            return cnt ; 

        }

        if(dp[i][j]!=-1)return dp[i][j] ; 



        if(a[i]==b[j] and b[j]==c[k]){

            int op1 = fun(a ,b,c , i+1, j , i+j+1 ,dp) ; 

            int op2 = fun(a, b, c , i, j+1, i+j+1,dp) ; 

            // int op3 = fun(a ,b,c , i+1, j , i+j+1,dp )+1 ; 

            // int op4 = fun(a, b, c , i, j+1, i+j+1,dp)+1 ; 

            return dp[i][j]=min({op1,op2}) ;



        }

        else if(a[i]==c[k]){

            int op1 =  fun(a,b,c, i+1, j , i+j+1,dp) ; 

            int op2 = fun(a, b,c ,i, j+1, i+j+1,dp) +1 ; 

            return dp[i][j]=min(op1,op2) ; 

        }

        else if(b[j]==c[k]){

            int op1 =  fun(a, b,c,i, j+1, i+j+1,dp ); 

            int op2 = fun(a, b, c, i+1 , j, i+j+1,dp) +1 ; 

            return dp[i][j]=min(op1,op2) ; 

        }

        else {

            int op1 = fun(a, b, c, i+1, j , i+j+1,dp) ; 

            int op2 = fun(a,b, c, i, j+1, i+j+1 ,dp); 

            return dp[i][j]=min(op1,op2)+1 ; 



        }

        return 0 ; 

    }

    int lcs(string& a, string&b , int i , int j ){

        if(i>=a.size())return 0 ; 

        if(j>=b.size() ) return 0 ; 



        if(a[i]==b[j]){

            return 1+ lcs(a, b, i+1, j+1 ) ; 

        }

        else {

            int op1 = lcs(a,b, i+1, j ) ; 

            int op2 = lcs(a, b, i,j+1 ) ; 

            return max(op1,op2) ; 

        }

        return 0 ; 

    }

    void solve()

    {  

      string a , b,c ; 

      cin>>a>>b>>c ; 

      int n = a.size() ; 

      int m= b.size() ; 

      vector<vector<int>>dp(n, vector<int>(m,-1)); 

      int ans = fun(a,b, c, 0 , 0 , 0, dp) ; 

      cout<<ans<<"\n" ; 

    //   int res = -2 ; 

    //   for(int i=0 ; i<2*n+2; i++){

    //     res = max(res, dp[n-1][i]); 

    //   }

    //   cout<<res<<"\n"; 

      //print(dp);  

    // int x =lcs(a, c , 0 , 0) ; 

    // int y =lcs(b,c , 0 , 0 ) ; 

    // cout<<(n+m)-(x+y)<<"\n"; 

    }

    signed main()

    {

    # ifndef ONLINE_JUDGE 

    freopen("input.txt", "r", stdin); 

    cout << "Reading from input.txt\n";

    freopen("output.txt", "w", stdout); 



    if (!freopen("input.txt", "r", stdin)) {

        cerr << "Could not open input.txt\n";   

        return 1;

    }



    #endif 



        //fastio()  ;

        int  t;

    cin >> t;

    // t=1 ; 



    for(int it=1;it<=t;it++) {

     

        // if(it==246){

              

        //      int n , m ; 

        //      cin>>n>>m ; 

        //      string s ="" ; 

        //      for(int i =0 ; i<n ; i++){

        //         string a ; 

        //         cin>>a ; 

        //         s+=a ; 

        //         s+='0';

        //      }

        //      vector<int>ans ; 

        //      for(int i = 0 ; i<m ; i++){

        //             int  x ;

        //             cin>>x ; 

        //             ans.push_back(x) ; xv 

        //      }



        //      cout<<s<<" "; 

        //      for(auto it : ans )cout<<it<<"\n"; 

        // }

        // else 

        solve();

    }

    return 0;

    }

Answer: 2