Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

typedef int64_t ll;

template <class T1, class T2>
using dict = std::unordered_map<T1, T2>;

vector<int> compare(string d, string e){
   vector<int> ans;
    for(int i=-(int)e.size()+1;i<(int)d.size();i++){
        bool ok = true;
        int d_end = min((int)e.size()+i, (int)d.size());
        int d_start = max(i, 0);
        int e_start = max(-i,0);
        //cout << e_start << " " << d_start << " " << d_end << endl;
        rep(j,d_end - d_start){
            if(!(d.at(d_start+j) == e.at(e_start+j) || d.at(d_start+j) == '?' ||
                    e.at(e_start+j) == '?')){
                    ok = false;
                    break;
                }
        }
        if (ok)
            ans.push_back(i);
    }
        
    return ans;

}

unordered_set<int> seter(vector<int> ab){
    unordered_set<int> ans;
    for (auto i:ab) ans.insert(i);
    return ans;
}

int main(){

    string a,b,c;
    cin >> a >> b >> c;
    vector<int> ab = compare(a,b);
    vector<int> bc = compare(b,c);
    vector<int> ac = compare(a,c);
    unordered_set<int> abs = seter(ab);
    unordered_set<int> bcs = seter(bc);
    unordered_set<int> acs = seter(ac);
    //for (auto i:ab) cout<< i <<endl;
    //for (auto i:bc) cout<< i <<endl;
    //for (auto i:ac) cout<< i <<endl;
    int ans = 1000000;
    for (auto i :ab){
        for (auto j : ac){
            if (bcs.count(j-i)>0 || j-i<0 || j-i>=(int)a.size()){
                int left = min(i,min(j,0));
                int right = max((int)a.size(),max(i+(int)b.size(),j+(int)c.size()));
                ans = min(right-left,ans);
            }
        }
    }
    for (auto i :ab){
        for (auto j : bc){
            if (acs.count(j+i)>0|| j+i<0 || j+i>=(int)b.size()){
                int left = min(-i,min(j,0));
                int right = max(-i+(int)a.size(),max((int)b.size(),j+(int)c.size()));
                ans = min(right-left,ans);
            }
        }
    }
    for (auto i :ac){
        for (auto j : bc){
            if (abs.count(j-i)>0|| -j+i<0 || -j+i>=(int)c.size()){
                int left = min(-i,min(-j,0));
                int right = max(-i+(int)a.size(),max(-j+(int)b.size(),(int)c.size()));
                ans = min(right-left,ans);
            }
        }
    }
    if ((int)(a.size()+b.size()+c.size)>ans) cout << ans << endl;
    else cout << (int)(a.size()+b.size()+c.size) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:81:35: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   81 |     if ((int)(a.size()+b.size()+c.size)>ans) cout << ans << endl;
      |                                 ~~^~~~
      |                                       ()
a.cc:82:44: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   82 |     else cout << (int)(a.size()+b.size()+c.size) << endl;
      |                                          ~~^~~~
      |                                                ()