#include <string>
#include <regex>
#include <iostream>
int main()
{
std::string line{"my name is my name and not my name mysometext myto"}; //this is the original line
std::cout << line << std::endl;
std::string replaceThis,replaceWith;
std::cout<<"Enter the word that you want to replace in the above: ";
std::getline(std::cin, replaceThis);
std::cout<<"Enter the word that you want to replace it with: ";
std::getline(std::cin, replaceWith);
std::regex pattern("\\b" + replaceThis + "\\b");
std::string replacedLine = std::regex_replace(line, pattern, replaceWith);
std::cout<<replacedLine<<std::endl;
}