Language: C++

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

#define int long long
const int N = 6005;

char a[N],b[N],c[N],s[N],p[N];
int la,lb,lc,ls;

bool fail(char x,char y) {
    if(x=='?' || y=='?') return false;
    if(x==0 || y==0) return false;
    return x!=y;
}

char cmax(char x,char y) {
    if(x=='?' || !x) return max(1ll*y,32ll);
    if(y=='?' || !y) return max(1ll*x,32ll);
    return max(1ll*x,32ll);
}

void solve(char *a, char *b, char *s) {
    int la=strlen(a);
    int lb=strlen(b);
    int ls=strlen(s);
    int _i=0,_t=0,ans=1e9;
    for(int i=0;i<max(la,lb)+1;i++) {
        int fg=1;
        for(int j=0;j<max(la,lb);j++) if(fail(a[i+j],b[j])) fg=0;
        if(fg) {
            memset(s,0,sizeof s);
            for(int j=0;j<i;j++) s[j]=max(32ll,1ll*a[j]);
            for(int j=0;j<lb;j++) s[i+j]=cmax(a[i+j],b[j]);
            ans=min(1ull*ans,strlen(s));
            if(ans==strlen(s)) _i=i,_t=0;
        }
        fg=1;
        for(int j=0;j<max(la,lb);j++) if(fail(b[i+j],a[j])) fg=0;
        if(fg) {
            memset(s,0,sizeof s);
            for(int j=0;j<i;j++) s[j]=max(32ll,1ll*b[j]);
            for(int j=0;j<la;j++) s[i+j]=cmax(b[i+j],a[j]);
            ans=min(1ull*ans,strlen(s));
            if(ans==strlen(s)) _i=i,_t=1;
        }
    }
    {
        int i=_i;
        memset(s,0,sizeof s);
        if(_t==0) {
            for(int j=0;j<i;j++) s[j]=max(32ll,1ll*a[j]);
            for(int j=0;j<lb;j++) s[i+j]=cmax(a[i+j],b[j]);
            s[i+lb]=0;
        }
        else {
            for(int j=0;j<i;j++) s[j]=max(32ll,1ll*b[j]);
            for(int j=0;j<la;j++) s[i+j]=cmax(b[i+j],a[j]);
            s[i+la]=0;
        }
    }
}

int solve() {
    memset(s,0,sizeof s);
    memset(p,0,sizeof p);
    la=strlen(a);
    lb=strlen(b);
    lc=strlen(c);
    solve(a,b,s);
    ls=strlen(s);
    solve(c,s,p);
    return strlen(p);
}

char aa[N],bb[N],cc[N];

signed main() {
    int ans=1e9;
    cin>>aa>>bb>>cc;
    memcpy(a,aa,sizeof aa);
    memcpy(b,bb,sizeof bb);
    memcpy(c,cc,sizeof cc);
    ans=min(ans,solve());
    memcpy(b,aa,sizeof aa);
    memcpy(c,bb,sizeof bb);
    memcpy(a,cc,sizeof cc);
    ans=min(ans,solve());
    memcpy(c,aa,sizeof aa);
    memcpy(a,bb,sizeof bb);
    memcpy(b,cc,sizeof cc);
    ans=min(ans,solve());
    cout<<ans;
}


Compiler output:
a.cc: In function 'void solve(char*, char*, char*)':
a.cc:34:20: error: no matching function for call to 'min(long long unsigned int, size_t)'
   34 |             ans=min(1ull*ans,strlen(s));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~
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:34:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'size_t' {aka 'long unsigned int'})
   34 |             ans=min(1ull*ans,strlen(s));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~
/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:34:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   34 |             ans=min(1ull*ans,strlen(s));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~
a.cc:43:20: error: no matching function for call to 'min(long long unsigned int, size_t)'
   43 |             ans=min(1ull*ans,strlen(s));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~
/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:43:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'size_t' {aka 'long unsigned int'})
   43 |             ans=min(1ull*ans,strlen(s));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~
/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:43:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   43 |             ans=min(1ull*ans,strlen(s));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~