#include <iostream>
#include <algorithm>
using namespace std;
int main(int argc, const char * argv[]) {
string S;
while (getline(cin,S)) {
string T=S;
transform(T.begin(), T.end(), T.begin(), (int (*)(int))toupper);
while (T.find("MARSHTOMP")!=T.npos){
S=S.replace(T.find("MARSHTOMP"),9, "fjxmlhx");
T=T.replace(T.find("MARSHTOMP"),9, "fjxmlhx");
}
cout<<S<<endl;
}
return 0;
}
在网上找了几个,感觉不是很简洁,贴上自己的。