This repository has been archived on 2024-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
lessons/C++/lesson4/task7.cpp
2023-07-16 13:23:25 +00:00

20 lines
371 B
C++

#include <iostream>
#include <string>
int main() {
std::string s;
std::string f;
std::string r;
std::getline(std::cin, s);
std::getline(std::cin, f);
std::getline(std::cin, r);
size_t pos = s.find(f);
while (pos != std::string::npos) {
s.replace(pos, f.length(), r);
pos = s.find(f);
}
std::cout << s << '\n';
}