What is talking about

Source: Internet
Author: User

Description

Ignatius is so lucky that he met a Martian yesterday. But he didn ' t know the language, the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want to translate, the history book into 中文版. Can you help him?

Input

The problem has only one test case, the test case consists of the parts, the dictionary part and the book part. The dictionary part starts with a single line contains a string "START", this string should is ignored, then some lines fo Llow, each line contains and strings, the first one is a word in 中文版, the second one is the corresponding word in Mart Ian ' s language. A line with a single string "End" indicates the end of the directory part, and this string should is ignored. The book part starts with a single line contains a string "START", this string should is ignored, then an article written In Martian ' s language. You should translate the article into 中文版 with the dictionary. If you find the word in the dictionary should translate it and write the new Word to your translation if you can ' t Find the word in the "dictionary" is not a translate it, and just copy the old Word to your translation. Space ('), tab (' \ t '), enter (' \ n ') and all the punctuation should not BE translated. A line with a single string "End" indicates the end of the book part, and that ' s also the end of the input. All the words is in the lowercase, and each word would contain at most of the characters, and each line would contain at most 3 Characters.

Output

In this problem, you has the to output the translation of the history book.

Sample Input

Sample Output

Hello, I ' m from mars.i like earth!                  

Hint


The code is as follows:

#include <stdio.h> #include <iostream> #include <string.h>using namespace std;struct node{int count;        Char s[200];struct node *a[27];node () {count=0; memset (A,0,sizeof (a));}; struct node *k,*d;char s[1001],s1[1001],s2[1001];void Insert (char C1[],char c2[]) {d=k;int W=strlen (C1); for (int i=0;i    <w;i++) {if (d->a[c1[i]-' a ']==null) d->a[c1[i]-' a ']=new node; D=d->a[c1[i]-' a '];} d->count=1;strcpy (D-&GT;S,C2);}    Char *find (char c1[]) {d=k;int W=strlen (C1); for (int i=0;i<w;i++) {d=d->a[c1[i]-' a ']; if (d==0) return NULL;} if (d->count==0) return Null;return D->s;} int L;char Z[2333];int Main () {scanf ("%s", &s), K=new node;while (1) {scanf ("%s", &s1), if (strcmp (S1, "END") ==0) BREAK;SCANF ("%s", &s2); insert (S2,S1);}    scanf ("%s", &s); GetChar (); while (1) {gets (s), if (strcmp (S, "END") ==0) break;for (int i=0;i<strlen (s); i++) {l=0;    while (s[i]>= ' a ' &&s[i]<= ' Z ') z[l++]=s[i++];    z[l]= ' + ';    Char *ans=find (z); if (ans==0) COut<<z;    else cout<<ans; Cout<<s[i];} Cout<<endl;} return 0;}

What is talking about

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.