#include <iostream>
#include <string>
using namespace std;
void main()
{
string s="Hello Lucy!";
//s.replace(5,1,"Lily");
//"Lucy" -> "Lily"
int indexStart=s.find("Lucy");
string l("Lily");
int len=l.length();
if (indexStart>=)
{
s.replace(indexStart,len,"Lily");
}
cout<<s<<endl;
}
//
// Hello Lily!
// Press any key to continue
#include <iostream>
#include <string>
using namespace std;
void main()
{
string s="Hello Lucy!I am Jim";
//s.replace(5,1,"Lily");
//"Lucy" -> "Lily"
string l("Jim");
int indexStart=s.find(l);
int len=l.length();
if (indexStart>=)
{
s.replace(indexStart,len,"Lily");
}
cout<<s<<endl;
}
// Hello Lucy!I am Lily
// Press any key to continue