1 条题解

  • 0
    @ 2025-12-23 20:46:41
    #include<bits/stdc++.h>
    using namespace std;
    int pos;
    int main(){
    	string s,a,t;
    	getline(cin,s);
    	getline(cin,a);
    	getline(cin,t);
    	int len=a.length();
    	while(s.find(a,pos)!=-1){
    		pos=s.find(a,pos);
    		s.replace(pos,len,t);
    		pos+=t.size();
    	}
    	cout<<s;
    	
    	return 0;
    }
    
    • 1

    信息

    ID
    4789
    时间
    1000ms
    内存
    16MiB
    难度
    10
    标签
    (无)
    递交数
    5
    已通过
    3
    上传者