#include <iostream>
#include <string>
using namespace std;
int main()
{
string s = "";
cout << "Enter string:" << endl;
getline(cin, s);
string result = "";
for (const auto& symbol : s)
if (symbol == '1')
result += "one";
}
else
result += symbol;
cout << result << endl;
Объяснение:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s = "";
cout << "Enter string:" << endl;
getline(cin, s);
string result = "";
for (const auto& symbol : s)
{
if (symbol == '1')
{
result += "one";
}
else
{
result += symbol;
}
}
cout << result << endl;
}
Объяснение: