#include <iostream>
#include <string>
#include <algorithm>

int main() {
   std::string x[] = {"I", "don't", "hate", "c++"};
   std::replace( std::begin( x ), std::end( x ), "hate", "love" );
   for( const auto &str : x )
      std::cout << str << ' ';
   std::cout << std::endl;
}