Language: C++

#inckude<bits/stdc++.h>
using namespace std;
bool sma(string a, string b) {
  int i = 0;
  while(a[i] == b[i] && i < a.size()) i ++;
  if (i == a.size() - 1) return true;
  return (int)a[i] < (int)b[i];
}
int main () {
  string S, T;
  cin >> S >> T;
  string ans = "";
  for (int i = 0; i < 50; i ++) ans += "z";
  int N = S.size();
  int n = T.size();
  for (int i = 0; i < N - n; i ++) {
    string a = S;
    bool ok = true;
    for (int j = i; j < n; j ++) {
      if (a[j] != T[j - i] && a[j] != '?') ok = false;
      else if (a[j] == '?') a[j] = T[j - i];
    }
    if (!ok) continue;
    for (int j = 0; j < N; j ++) {
      if (a[j] == '?') a[j] = 'a';
    }
    if (sma(a, ans)) ans = a;
  }
  cout << ans << endl;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inckude; did you mean #include?
    1 | #inckude<bits/stdc++.h>
      |  ^~~~~~~
      |  include
a.cc:3:10: error: 'string' was not declared in this scope
    3 | bool sma(string a, string b) {
      |          ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | #inckude<bits/stdc++.h>
a.cc:3:20: error: 'string' was not declared in this scope
    3 | bool sma(string a, string b) {
      |                    ^~~~~~
a.cc:3:20: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:3:28: error: expression list treated as compound expression in initializer [-fpermissive]
    3 | bool sma(string a, string b) {
      |                            ^
a.cc: In function 'int main()':
a.cc:10:3: error: 'string' was not declared in this scope
   10 |   string S, T;
      |   ^~~~~~
a.cc:10:3: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >> S >> T;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inckude<bits/stdc++.h>
a.cc:11:10: error: 'S' was not declared in this scope
   11 |   cin >> S >> T;
      |          ^
a.cc:11:15: error: 'T' was not declared in this scope
   11 |   cin >> S >> T;
      |               ^
a.cc:12:9: error: expected ';' before 'ans'
   12 |   string ans = "";
      |         ^~~~
      |         ;
a.cc:13:33: error: 'ans' was not declared in this scope
   13 |   for (int i = 0; i < 50; i ++) ans += "z";
      |                                 ^~~
a.cc:17:11: error: expected ';' before 'a'
   17 |     string a = S;
      |           ^~
      |           ;
a.cc:20:11: error: 'a' was not declared in this scope
   20 |       if (a[j] != T[j - i] && a[j] != '?') ok = false;
      |           ^
a.cc:25:11: error: 'a' was not declared in this scope
   25 |       if (a[j] == '?') a[j] = 'a';
      |           ^
a.cc:27:13: error: 'a' was not declared in this scope
   27 |     if (sma(a, ans)) ans = a;
      |             ^
a.cc:27:16: error: 'ans' was not declared in this scope
   27 |     if (sma(a, ans)) ans = a;
      |                ^~~
a.cc:27:19: error: 'sma' cannot be used as a function
   27 |     if (sma(a, ans)) ans = a;
      |                   ^
a.cc:29:3: error: 'cout' was not declared in this scope
   29 |   cout << ans << endl;
      |   ^~~~
a.cc:29:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:11: error: 'ans' was not declared in this scope
   29 |   cout << ans << endl;
      |           ^~~
a.cc:29:18: error: 'endl' was not declared in this scope
   29 |   cout << ans << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #inckude<bits/stdc++.h>