首页 > 其他分享 >meiri

meiri

时间:2024-11-28 09:54:54浏览次数:6  
标签:index int ++ len cin meiri length

include

include

using namespace std;

int main() {
int m;
cin >> m;

while (m--) {
    string s, t;
    cin >> s >> t;

    int s_len = s.length();
    int t_len = t.length();
    int t_index = 0;

    for (int i = 0; i < s_len; ++i) {
        if (t_index < t_len && (s[i] == '?' || s[i] == t[t_index])) {
            if (s[i] == '?') {
                s[i] = t[t_index];  
            }
            t_index++;
        }
    }

    if (t_index == t_len) {
        for (int i = 0; i < s_len; ++i) {
            if (s[i] == '?') {
                s[i] = 'a';  
            }
        }

        cout << "YES" << endl;
        cout << s << endl; 
    } else {
        cout << "NO" << endl;
    }
}

return 0;

}

标签:index,int,++,len,cin,meiri,length
From: https://www.cnblogs.com/Wind52HZ/p/18573630

相关文章