Language: C++


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

bool isMatch(char a,char b){
    if(a == '?' || b == '?'){
        return true;
    }else if(a == b){
        return true;
    }else{
        return false;
    }
}
int main() {
    string a,b,c;
    cin >> a >> b >> c;
    
    a_size = a.size()
    b_size = b.size()
    c_size = c.size()

    int max_n = a_size+b_size+c_size;
    string oringin_a = a;
    rep(i,max_n-a_size){
        a += "?";
    }
    
    rep(i,max_n){
        rep(j,b_size){
            if(j == b_size-1){
                //match
                rep(jkr,b_size){
                    a[i+jkr] = (a[i+jkr] == '?')?a[i+jkr]:b[jkr];
                    goto asdhuih;
                }
            }
            if(isMatch(b[j],a[j+i])){
                continue
            }else{
                break;
            }
        }
    }
    
asdhuih:
    b = c;
    b_size = c_size;
    
    rep(i,max_n){
        rep(j,b_size){
            if(j == b_size-1){
                //match
                rep(jkr,b_size){
                    a[i+jkr] = (a[i+jkr] == '?')?a[i+jkr]:"!";
                    goto qweoiu;
                }
            }
            if(isMatch(b[j],a[j+i])){
                continue
            }else{
                break;
            }
        }
    }
    
qweoiu:
    int cnt = 0;
    rep(i,max_n){
        if(a[max_n-i-1]=='?'){
            cnt++;
        }
    }
    
    cout << max_n-cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'a_size' was not declared in this scope; did you mean 'dysize'?
   20 |     a_size = a.size()
      |     ^~~~~~
      |     dysize
a.cc:26:11: error: 'max_n' was not declared in this scope
   26 |     rep(i,max_n-a_size){
      |           ^~~~~
a.cc:4:45: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
a.cc:30:11: error: 'max_n' was not declared in this scope
   30 |     rep(i,max_n){
      |           ^~~~~
a.cc:4:45: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
a.cc:31:15: error: 'b_size' was not declared in this scope; did you mean 'dysize'?
   31 |         rep(j,b_size){
      |               ^~~~~~
a.cc:4:45: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
a.cc:40:25: error: expected ';' before '}' token
   40 |                 continue
      |                         ^
      |                         ;
   41 |             }else{
      |             ~            
a.cc:49:5: error: 'b_size' was not declared in this scope; did you mean 'dysize'?
   49 |     b_size = c_size;
      |     ^~~~~~
      |     dysize
a.cc:49:14: error: 'c_size' was not declared in this scope; did you mean 'dysize'?
   49 |     b_size = c_size;
      |              ^~~~~~
      |              dysize
a.cc:51:11: error: 'max_n' was not declared in this scope
   51 |     rep(i,max_n){
      |           ^~~~~
a.cc:4:45: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
a.cc:56:49: error: operands to '?:' have different types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'const char*'
   56 |                     a[i+jkr] = (a[i+jkr] == '?')?a[i+jkr]:"!";
      |                                ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
a.cc:61:25: error: expected ';' before '}' token
   61 |                 continue
      |                         ^
      |                         ;
   62 |             }else{
      |             ~            
a.cc:70:11: error: 'max_n' was not declared in this scope
   70 |     rep(i,max_n){
      |           ^~~~~
a.cc:4:45: note: in definition of macro 'rep'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
a.cc:76:13: error: 'max_n' was not declared in this scope
   76 |     cout << max_n-cnt << endl;
      |             ^~~~~