40分求助
查看原帖
40分求助
1244509
renzhanwen楼主2024/8/19 10:59
#include<bits/stdc++.h>
using namespace std;
string s,a,b;
int main()
{
	getline(cin,s);
	cin>>a>>b;
	for(int i=0;i<s.size();i++)
	{
		if(i==0||(a[i-1]==' '&&a[i+a.size()]==' '))
		{
			bool o=true;
			int t=i;
			for(int j=0;j<a.size()&&o==true;j++)
			{
				if(s[t]!=a[j])
					o=false;
				t++;
			}
			if(o)
			{
				for(int j=0;j<b.size();j++)
					cout<<b[j];
				i=t-1;
			}	
		}
		else
			cout<<s[i];
	}	
	return 0;
}
2024/8/19 10:59
加载中...