Language: C++

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007


#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

ll d[3][3];

int main(){
  string s[3];
  cin>>s[0];
  cin>>s[1];
  cin>>s[2];
  rep(i,0,3){
    rep(j,0,3){
      if(i==j)continue;
      string s1 =s[i];
      string s2 = s[j];
      ll mn = s1.sz;
      rep(k,0,s1.sz){
        ll flag = 1;
        rep(l,0,s2.sz){
          if(k+l==s1.sz)break;
          if(s1[k+l]=='?')continue;
          if(s2[l]=='?')continue;
          if(s1[k+l]!=s2[l])flag = 0;
        }
        if(flag==1){
          mn = min(mn,k);
        }
      }
      d[i][j] = mn;
    }
  }
  vector<ll> v;
  rep(i,0,3){
    v.pb(i);
  }
  ll mn = s[0].sz+s[1].sz+s[2].sz;
  do{
    ll a1 = v[0];
    ll a2 = v[1];
    ll a3 = v[2];
    if(d[a1][a2]+s[a2].sz<=s[a1].sz){
      if(d[a1][a3]+s[a3].sz<=s[a1].sz){
        mn = min(mn,(ll)s[a1].sz);
      }
      else{
        mn = min(mn,d[a1][a3]+s[a3].sz);
      }
    }
    else{
      if(d[a2][a3]+s[a3].sz<=s[a2].sz){
        mn = min(mn,d[a1][a2]+s[a2].sz); 
      }
      else{
        mn = min(mn,d[a1][a2]+d[a2][a3]+s[a3].sz);
      }
    }
  }while(next_permutation(all(v)));
  cout << mn << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:120:17: error: no matching function for call to 'min(ll&, long long unsigned int)'
  120 |         mn = min(mn,d[a1][a3]+s[a3].sz);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 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:120:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
  120 |         mn = min(mn,d[a1][a3]+s[a3].sz);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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:120:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  120 |         mn = min(mn,d[a1][a3]+s[a3].sz);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:125:17: error: no matching function for call to 'min(ll&, long long unsigned int)'
  125 |         mn = min(mn,d[a1][a2]+s[a2].sz);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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:125:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
  125 |         mn = min(mn,d[a1][a2]+s[a2].sz);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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
/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:125:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  125 |         mn = min(mn,d[a1][a2]+s[a2].sz);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~
a.cc:128:17: error: no matching function for call to 'min(ll&, long long unsigned int)'
  128 |         mn = min(mn,d[a1][a2]+d[a2][a3]+s[a3].sz);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:128:17: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
  128 |         mn = min(mn,d[a1][a2]+d[a2][a3]+s[a3].sz);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
/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:128:17: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  128 |         mn = min(mn,d[a1][a2]+d[a2][a3]+s[a3].sz);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~