The fifth session of the Harbin Institute of Technology Program Design competition--b. Marsh Jump Fish

Source: Internet
Author: User

B. Marsh-jumping fish
Time limit:500 MS Memory limit:32768 K
Total submit:692 (336 users) Total accepted:336 (305 users) Special Judge: No
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
Hint

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;}


The fifth session of the Harbin Institute of Technology Program Design competition--b. Marsh Jump Fish

Related Article

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.