с помощью библиотеки string c++

Приложения:

Ответы

Ответ дал: clinteastwood2
0
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
    string str = "Hello wordl";
    string to_replace, word, result;
    stringstream ss( str );

    cin >> to_replace;

    while (ss >> word) 
    {
        if (word.find(to_replace) != string::npos)
        {   
            word = "...";   
        }
        result += word + " ";
    }

    cout << result << endl;
}
Вас заинтересует