-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1999D.cpp
More file actions
35 lines (33 loc) · 857 Bytes
/
1999D.cpp
File metadata and controls
35 lines (33 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main() {
int k;cin>>k;
while(k--) {
string s,t;cin>>s>>t;
int curr=0;
string final="";
if(s.size()<t.size()) {
cout<<"NO"<<endl;
}else{
rep(i,s.size()) {
if(s[i]=='?') {
if(curr<t.size()) {
s[i]=t[curr];
curr++;
}else {
s[i]=s[i-1];
}
}else if(curr<t.size() && s[i]==t[curr]) {
curr++;
}
}
if(curr==t.size()) {
cout<<"YES"<<endl;
cout<<s<<endl;
}else{
cout<<"NO"<<endl;
}
}
}
}