Hihocoder 1082: But the marsh-leaping fish has long seen everything.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.