Language: C++

#include <iostream>
#include <vector>
#include <map>

int firstmatch(string s, string p, char w){
  for(int i = 0; i < s.size(), i++){
    int j = 0;
    while(s[i+j] == p[j] || s[i+j] == w)j++;
    if(j == p.size() - 1) return i;
  }
  return -1;
}


int main(){
  string s, p;
  cin >> s >> p;
  int m = firstmatch(s, p, '?');
  if(m == -1) cout << "UNRESOLVED";
  else{
    for(int i = 0; i < s.size(); i++){
      if(i < m && s[i] == '?') s[i] = 'a';
      else if(i >= m && i < m + p.size()) s[i] = p[i - m];
      else if(i >= m + p.size() && s[i] == '?') s[i] = 'a';
    }
  }
  cout << s;
}

Compiler output:
a.cc:5:16: error: 'string' was not declared in this scope
    5 | int firstmatch(string s, string p, char w){
      |                ^~~~~~
a.cc:5:16: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:5:26: error: 'string' was not declared in this scope
    5 | int firstmatch(string s, string p, char w){
      |                          ^~~~~~
a.cc:5:26: note: suggested alternatives:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:5:36: error: expected primary-expression before 'char'
    5 | int firstmatch(string s, string p, char w){
      |                                    ^~~~
a.cc:5:42: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | int firstmatch(string s, string p, char w){
      |                                          ^
a.cc: In function 'int main()':
a.cc:16:3: error: 'string' was not declared in this scope
   16 |   string s, p;
      |   ^~~~~~
a.cc:16:3: note: suggested alternatives:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:17:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   17 |   cin >> s >> p;
      |   ^~~
      |   std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:17:10: error: 's' was not declared in this scope
   17 |   cin >> s >> p;
      |          ^
a.cc:17:15: error: 'p' was not declared in this scope
   17 |   cin >> s >> p;
      |               ^
a.cc:18:21: error: 'firstmatch' cannot be used as a function
   18 |   int m = firstmatch(s, p, '?');
      |           ~~~~~~~~~~^~~~~~~~~~~
a.cc:19:15: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   19 |   if(m == -1) cout << "UNRESOLVED";
      |               ^~~~
      |               std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:27:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |   cout << s;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~