there is no Mar Shto MP that is separated by a space. It is possible that there are more than two "marshtomp" in a sentence. It was a poor level at the time, but I feel like I've made a lot of progress lately and it's definitely related to recent diligence. Come back and do the subject. It feels pretty easy! Progress is able to feel the drop ... ~ ~! The final of the school race was abused! Alas ~ But now I will too! The method is to find the index value of all occurrences of marshtomp in a string with find (), using an array record. The original array is then output to each element, which is printed when the index value of the record is reached Replace the value with a lot of specific details. #include <iostream> #include <string> #include <string.h>using namespace Std;int main () {string str,st ; while (1) {getline (CIN,STR); st=str;for (int i=0;i<str.size (); i++) {if (Isalpha (str[i)) | | Isspace (Str[i]) str[i]=tolower (Str[i]);} int K=0,cnt=0;int ls[100];while (str.find ("Marshtomp", K)!=string::npos) {ls[cnt++]=str.find ("Marshtomp", k); k=ls[ Cnt-1]+9;} int dic=0;for (int j=0;j<str.size (); j + +) {if (J==ls[dic]) {cout<< "FJXMLHX";d ic++;j+=8;} ELSECOUT<<ST[J];} Cout<<endl;} return 0;}
|