1082: But the marsh-jumping fish has long seen through all time limits: 1000ms single point time limit: 1000ms memory limit: 256MB description
FJXMLHX is being brushed by a swamp fish every day, so he's eagerly finding you. You want to write a program that masks all the sentences in the Marsh Jump Fish ("marshtomp", not case sensitive). In order to make the sentence not lack of ingredients, unified replaced by "FJXMLHX".
Input
The input includes multiple lines.
Each line is a string with a length of not more than 200.
The end of a line has no relation to the beginning of the next line.
Output
The output contains multiple lines, as the input follows the result of the transformation in the description.
Sample input
The Marshtomp has seen it all before.
Marshtomp is beaten by fjxmlhx!
Amarshtompb
Sample output
The FJXMLHX has seen it all before.
Fjxmlhx is beaten by fjxmlhx!
Afjxmlhxb
The idea is to convert all the lowercase letters into another string,
Then use STRSTR (S1,S2) (Determine if S2 is a substring of S1) to find all Marshtomp locations,
and write it down so that the output can be replaced!
/*
The idea is to convert all the lowercase letters into another string,
Then use STRSTR (S1,S2) (Determine if S2 is a substring of S1) to find all Marshtomp locations,
and write it down so that the output can be replaced!
*/
#include <iostream>#include<algorithm>#include<cstdio>#include<cstring>#include<cmath>using namespaceStd;typedefLong LongLL;ConstLL n= About;intMain () {CharS[n]; while(Fgets (s,n,stdin)! =NULL) { Charstr[n]=""; intLen=strlen (s)-1, I; for(i=0; i<len; i++) if(s[i]>='A'&&s[i]<='Z') Str[i]=s[i]+ +; ElseStr[i]=S[i]; } inta[n]= {-1},j=0, p=0; while(1) { Char*K; if(Strstr (Str+j,"Marshtomp")) K=strstr (Str+j,"Marshtomp"); Else Break; intM= (k-&str[0])/sizeof(Char); J+=9; A[p++]=m; } J=0; for(i=0; i<len; i++) { if(i==A[j]) {J++; printf ("FJXMLHX"); I+=8; } Elseprintf ("%c", S[i]); } printf ("\ n"); } return 0;}
Hihocoder 1082: But the marsh-leaping fish has long seen everything.