Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
//#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define sll                     set<ll>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define umcl                    um<char,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif
}

ll cal(string a,string b,string c)
{
	ll asz=a.size();
	ll bsz=b.size();
	ll csz=c.size();
	ll ans=asz+bsz+csz;
	for(ll i=0;i<asz;++i)
	{
		ll flag=1;
		string temp=a;
		for(ll j=0;j<bsz;++j)
		{
			if(i+j>=asz)
			{
				temp+=b[j];
			}
			else if((b[j]!=a[i+j])&&(b[j]!='?')&&(a[i+j]!='?'))
				flag=0;
		}
	//	db(temp);
		ll tsz=temp.size();
		if(flag)
		{
			ans=min(ans,tsz+c.size());
		//	db(temp);
			for(ll i=0;i<tsz;++i)
			{
				ll flag1=1;
				string temp1=temp;
				for(ll j=0;j<csz;++j)
				{
					if(i+j>=tsz)
					{
						temp1+=c[j];
					}
					else if((c[j]!=temp[i+j])&&(c[j]!='?')&&(temp[i+j]!='?'))
						flag1=0;
				}
				if(flag1)
					ans=min(ans,(ll)temp1.size());
			}
			
		}
	}

	return ans;
}

int main()
{
	fastIO
	//inp_out();
	string a,b,c;
	cin>>a>>b>>c;
	ll ans;
	ans=cal(a,b,c);
	ans=min(ans,cal(a,c,b));
	ans=min(ans,cal(b,a,c));
	ans=min(ans,cal(b,c,a));
	ans=min(ans,cal(c,a,b));
	ans=min(ans,cal(c,b,a));
	cout<<ans;
	return 0;
}



Compiler output:
a.cc: In function 'long long int cal(std::string, std::string, std::string)':
a.cc:70:32: error: no matching function for call to 'min(long long int&, long long unsigned int)'
   70 |                         ans=min(ans,tsz+c.size());
      |                             ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:70:32: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   70 |                         ans=min(ans,tsz+c.size());
      |                             ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:70:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   70 |                         ans=min(ans,tsz+c.size());
      |                             ~~~^~~~~~~~~~~~~~~~~~