http://hihocoder.com/problemset/problem/1082
First, the whole letter of the string into lowercase, constantly using find find Marshtomp in the string, and each character into ' # ', and finally unified ' # ' to replace it.
1#include <cstdio>2#include <string>3#include <iostream>4 using namespacestd;5 intMain ()6 {7 //freopen ("A.txt", "R", stdin);8 strings,s1,s2;9 while(Getline (cin,s))Ten { Ones1=s; A for(intI=0; I<s.length (); i++) - { - if(Isalpha (S[i])) s[i]=ToLower (S[i]); the } - intt=-1; -T=s.find ("Marshtomp"); - //cout<<s<<endl; + while(t!=-1) - { + //cout<<t<<endl; A for(inti=t;i<t+9; i++) ats[i]='#'; -T=s.find ("Marshtomp"); - //cout<<s<<endl; - } -S2=""; - for(intI=0; I<s.length (); i++) in { - if(s[i]!='#') s2+=S1[i]; to Else if(s[i]=='#') + { -s2+="FJXMLHX"; thei+=8; * } $ }Panax Notoginsengcout<<s2<<Endl; - } the return 0; +}
Hihocoder 1082 However, the marsh-leaping fish has long seen everything. (String processing)