Untitled

mail@pastecode.io avatar
unknown
plain_text
9 months ago
356 B
4
Indexable
Never
#include<iostream>
#include<string>
using namespace std;
main(){
  string s, s1,s2;
  cin>>s>>s1>>s2;
  string ans=s;
  int l=s.length();
  int l1=s1.length();
  
  int b;
  b=s.find(s1);
  //s.insert(2,s1);
  //cout<<s;
  for(int i=0; i<l; i++){
    b=s.find(s1);
    if(b==-1) break;
    s.erase(b,l1);
    s.insert(b,s2);
    
  
  }
  cout<<s;
    
  }
Leave a Comment