Language: C++

#include <bits/stdc++.h>

using namespace std;
unsigned long long ans=1e9;
string a,b,c;
inline int read() {
	char ch = getchar();
	int x = 0, f = 1;
	while (ch < '0' || ch > '9')
		f = (ch == '-' ? -1 : 1), ch = getchar();
	while (ch >= '0' && ch <= '9')
		x = x * 10 + ch - 48, ch = getchar();
	return x * f;
}
inline string merge(string a,string b) {
	int st=0;//a的第st位开始
	for(st=0; st<a.size(); st++) {
		int flag=1;
		for(int cur=0; st+cur<a.size()&&cur<b.size(); cur++)
			if(b[cur]!=a[st+cur]&&a[st+cur]!='?'&&b[cur]!='?') {
				flag=0;
				break;
			}
		if(flag) break;
	}
	for(int j=st; j<a.size()&&j-st<b.size(); j++) {
		if(b[j-st]!='?')
			a[j]=b[j-st];
	}
	if(st+b.size()-1>=a.size())
		for(int j=a.size()-st; j<b.size(); j++)
			a.push_back(b[j]);
	return a; 
}
int main() {
	cin>>a>>b>>c;
	ans=min(ans,min(merge(merge(a,b),c).size(),merge(c,merge(a,b)).size()));
	ans=min(ans,min(merge(merge(a,c),b).size(),merge(b,merge(a,c)).size()));
	ans=min(ans,min(merge(merge(b,a),c).size(),merge(c,merge(b,a)).size()));
	ans=min(ans,min(merge(merge(b,c),a).size(),merge(a,merge(b,c)).size()));
	ans=min(ans,min(merge(merge(c,a),b).size(),merge(b,merge(c,a)).size()));
	ans=min(ans,min(merge(merge(c,b),a).size(),merge(a,merge(c,b)).size()));
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:16: error: no matching function for call to 'min(long long unsigned int&, const long unsigned int&)'
   37 |         ans=min(ans,min(merge(merge(a,b),c).size(),merge(c,merge(a,b)).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:37:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long unsigned int')
   37 |         ans=min(ans,min(merge(merge(a,b),c).size(),merge(c,merge(a,b)).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:37:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   37 |         ans=min(ans,min(merge(merge(a,b),c).size(),merge(c,merge(a,b)).size()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:38:16: error: no matching function for call to 'min(long long unsigned int&, const long unsigned int&)'
   38 |         ans=min(ans,min(merge(merge(a,c),b).size(),merge(b,merge(a,c)).size()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:38:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long unsigned int')
   38 |         ans=min(ans,min(merge(merge(a,c),b).size(),merge(b,merge(a,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
/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:38:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   38 |         ans=min(ans,min(merge(merge(a,c),b).size(),merge(b,merge(a,c)).size()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:39:16: error: no matching function for call to 'min(long long unsigned int&, const long unsigned int&)'
   39 |         ans=min(ans,min(merge(merge(b,a),c).size(),merge(c,merge(b,a)).size()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:39:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long unsigned int')
   39 |         ans=min(ans,min(merge(merge(b,a),c).size(),merge(c,merge(b,a)).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
/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:39:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   39 |         ans=min(ans,min(merge(merge(b,a),c).size(),merge(c,merge(b,a)).size()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:40:16: error: no matching function for call to 'min(long long unsigned int&, const long unsigned int&)'
   40 |         ans=min(ans,min(merge(merge(b,c),a).size(),merge(a,merge(b,c)).size()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:40:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long unsigned int')
   40 |         ans=min(ans,min(merge(merge(b,c),a).size(),merge(a,merge(b,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
/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:40:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
   40 |         ans=min(ans,min(merge(merge(b,c),a).size(),merge(a,merge(b,c)).size()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:41:16: error: no matching function for call to 'min(long long unsigned int&, const long unsigned int&)'
   41 |         ans=min(ans,min(merge(merge(c,a),b).size(),merge(b,merge(c,a)).size()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:41:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long unsigned int')
   41 |         ans=min(ans,min(merge(merge(c,a),b).size(),merge(b,merge(c,a)).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
/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