c++ replace
#include <iostream>
#include <string>
using namespace std;
int main() {
string str = "Hello, world!";
// Find the position of the comma
size_t pos = str.find(",");
// Replace the comma with an exclamation mark
str.replace(pos, 1, "!");
// Print the modified string
cout << str << endl;
return 0;
}