#include <bits/stdc++.h>
using namespace std;
string s;
string t;
int main() {
cin>>s>>t;
int lens=s.size();
int lent=t.size();
for (int i=lens-lent;i>=0;i--){//从后往前匹配
bool flag=1;
for (int j=0;j<lent;j++){
if (t[j]!=s[i+j]&&s[i+j]!='?'){
flag=0;
break;
}
}
if (flag==1){//一旦匹配成功,改成t
for (int j=0;j<lent;j++){
s[i+j]=t[j];
}
break;
}
}
for (int i=0;i<lens;i++){//其他问号都改成‘A’
if (s[i]=='?'){
s[i]='A';
}
}
cout<<s;
return 0;
}
评论区