New paste Repaste Download
#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;
}
Filename: None. Size: 652b. View raw, , hex, or download this file.

This paste expires on 2026-05-06 19:13:50.611542+00:00. Pasted through web.