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

Source: Internet
Author: User

#1082: However, the marsh-jumping fish has long seen through all time limits:1000msSingle Point time limit:1000msMemory Limit:256MBDescribe

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 have seen it all before.marshtomp are beaten by fjxmlhx! Amarshtompb
Sample output
 the FJXMLHX have seen it all before.fjxmlhx are beaten by fjxmlhx! AFJXMLHXB 

algorithm: This is a string processing problem, that is, in the original string encountered a string of special string, I do not output it
I use the other string to replace the output! The
first lowercase of the original string exists in another string, using the string and that particular string to do a lookup
process, is to find out the special string in the original string after processing all the location to find and store. The
then outputs the raw string that is not processed, and if it encounters a particular position of those records, it outputs the alternate string of the special string,
so ok!


Code:
#include <string.h> #include <stdio.h> #include <ctype.h>int a[200];int e;void find_pos (char *s, char *    t) {int i, J;    int Len, LL;    Len=strlen (s)-strlen (t);    Ll=strlen (t);    e=0;    Memset (A,-1, sizeof (-1));                For (i=0, i<=len; i++) {if (s[i]==t[0]) {for (j=1; j<ll; J + +) {                if (S[i+j]!=t[j]) {break;            }} if (J==ll) {a[e++]=i;        } j=0;    }}}int Main () {char s[300];    Char ss[300];    Char *t= "Marshtomp";    int I, J;    int Len;        while (gets (s)!=null) {Len=strlen (s);        for (i=0; i<len; i++) {ss[i]=tolower (s[i]);        } find_pos (ss, T);        int k=0;        for (i=0; i<len;)                {if (I==a[k]) {printf ("fjxmlhx");                i+=9;            k++;   } else         {printf ("%c", S[i]);            i++;    }} printf ("\ n"); } return 0;}

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

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.