| #include <iostream>
|
| #include <string>
|
|
|
| int main (void)
|
| {
|
| std::string target_str;
|
| std::string old_code;
|
| std::string new_code;
|
|
|
| std::getline (std::cin, target_str);
|
| std::getline (std::cin, old_code);
|
| std::getline (std::cin, new_code);
|
|
|
| if (old_code.find_first_not_of (' ') != std::string::npos)
|
| {
|
| size_t pos = target_str.find (old_code, 0);
|
| while (pos != std::string::npos)
|
| {
|
| target_str.replace (pos, old_code.size (), new_code);
|
| pos = target_str.find (old_code, pos + new_code.size ());
|
| }
|
| }
|
|
|
| std::cout << target_str << std::endl;
|
| }
|