然而沼跃鱼早就看穿了一切
水题,但是凡是字符串处理的题,都要非常小心,因为一不小心,就会出错,我也wrong了很多次。。。
AC代码:
#include <iostream>
#include <cstdio>
#include <cctype>
#include <string>
using namespace std;
int main()
{
string s,sa;
string a="marshtomp";
while(getline(cin,s))
{
int i,j,l=s.size(),k,flag;
sa="";
int ll = a.size();
for(i = 0; i < l; i++)
{
for(j = 0; j < ll; j++)
if(i + j > l || tolower(s[i+j]) != a[j])
break;
if(j == ll)
{
printf("fjxmlhx");
i += ll - 1;
}
else
printf("%c",s[i]);
}
printf("\n");
}
return 0;
}