#include<bits/stdc++.h>
using namespace std;
int main()
{
string s2;
getline(cin,s2);
string s;
getline(cin,s);
for(int i=0;i<s.length();i++)
{
if(s2[0]==s[i]&&s2.length()+i<s.length())
{
bool f=1;
for(int j=0;j<s2.length();j++)
{
if(s[i+j]!=s2[j]){f=0;break;
}
}
if(f){cout<<"\n";i+=s2.length()-1;continue;
}
}
cout<<s[i];
}
}
AC (3ms, 352KB)
|
CPP
|