Language: C++

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
 
typedef long long  ll;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
string s,t;
int main(){
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    for(int i=n-m;i>=0;i--){
        int chk = 0;
        for(int j=0;j<m;j++){
            if(s[i+j]=='?' || s[i+j]==t[j]) continue;
            else {
                chk = 1;
                break;
            }
        }
        if(!chk){
            for(int j=0;j<m;j++)
                s[i+j] = t[j];
            for(int i=0;i<n;i++){
                if(s[i]=='?') s[i] = 'a';
            }
            cout << s << endl;
            return 0;
        }
    }
    printf("UNRESTORABLE\n");
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
string s,t;
int main(){
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    for(int i=n-m;i>=0;i--){
        int chk = 0;
        for(int j=0;j<m;j++){
            if(s[i+j]=='?' || s[i+j]==t[j]) continue;
            else {
                chk = 1;
                break;
            }
        }
        if(!chk){
            for(int j=0;j<m;j++)
                s[i+j] = t[j];
            for(int i=0;i<n;i++){
                if(s[i]=='?') s[i] = 'a';
            }
            cout << s << endl;
            return 0;
        }
    }
    printf("UNRESTORABLE\n");
    return 0;
}


Compiler output:
a.cc:78:8: error: redefinition of 'std::string s'
   78 | string s,t;
      |        ^
a.cc:48:8: note: 'std::string s' previously declared here
   48 | string s,t;
      |        ^
a.cc:78:10: error: redefinition of 'std::string t'
   78 | string s,t;
      |          ^
a.cc:48:10: note: 'std::string t' previously declared here
   48 | string s,t;
      |          ^
a.cc:79:5: error: redefinition of 'int main()'
   79 | int main(){
      |     ^~~~
a.cc:49:5: note: 'int main()' previously defined here
   49 | int main(){
      |     ^~~~