每日一题:https://codeforces.com/contest/1999/problem/D

题目链接:https://codeforces.com/contest/1999/problem/D

#include<iostream>
#include<string>
#include <vector>
using namespace std;

int main(){
    int n;
    cin>>n;
    for(;n>0;n--){
        string arr1;
        string arr2;
        cin>>arr1>>arr2;
        int t1=arr1.length();
        int t2=arr2.length();
        int di=0,o=0;
        bool yes=0;
        bool  yes1=1;
        for(int i=0;i<t1&&o<t2;i++){
            if(arr1[i]==arr2[o]){
                o++;
            } else if(arr1[i]=='?'){
                arr1[i]=arr2[o];
                o++;
            }
        }
       if(o==t2){
yes=1;
}
if(yes){
for(int j=di;j<t1;j++){
if(arr1[j]=='?'){
arr1[j]='a';
}}
cout<<"YES"<<endl<<arr1<<endl;
} else{
cout<<"NO"<<endl;
}
}
return 0;
}
~~~~~~~~~~~~~~

posted on 2024-11-28 14:56  神奇猫猫侠  阅读(7)  评论(0编辑  收藏  举报

导航