#include <string> 
#include <cstdio> 

int main() 
{ 
  std::string s = "Hello"; 
  s += ", world!"; 
  std::printf("%s\n", s.c_str()); 

  std::string::size_type idx = s.find("world"); 
  if (idx != std::string::npos) 
  { 
    s.replace(idx, 5, "moon"); 
    std::printf("%s\n", s.c_str()); 
  } 
} 