#include <iostream>
#include <algorithm> // reverse
#include <string>
void reverseWord(std::string &str, std::string word) {
size_t pos = str.find(word);
if (pos != std::string::npos) {
std::reverse(str.begin() + pos, str.begin() + pos + word.length());
}
}
int main() {
std::string str = "C++ C Java Python PHP C#";
std::string word = "Java";
reverseWord(str, word);
std::cout << str << std::endl;
}
/*
run:
C++ C avaJ Python PHP C#
*/