What Are You Talking About

What Are You Talking About

Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K (Java/Others)
Total Submission(s): 237 Accepted Submission(s): 117
 
Problem 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 English. Can you help him?
 
Input
The problem has only one test case, the test case consists of two parts, the dictionary part and the book part. The dictionary part starts with a single line contains a string "START", this string should be ignored, then some lines follow, each line contains two strings, the first one is a word in English, the second one is the corresponding word in Martian's language. A line with a single string "END" indicates the end of the directory part, and this string should be ignored. The book part starts with a single line contains a string "START", this string should be ignored, then an article written in Martian's language. You should translate the article into English with the dictionary. If you find the word in the dictionary you should translate it and write the new word into your translation, if you can't find the word in the dictionary you do not have to 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 are in the lowercase, and each word will contain at most 10 characters, and each line will contain at most 3000 characters.
 
Output
In this problem, you have to output the translation of the history book.
 
Sample Input
START
from fiwo
hello difh
mars riwosf
earth fnnvk
like fiiwj
END
START
difh, i'm fiwo riwosf.
i fiiwj fnnvk!
END
 
Sample Output
hello, i'm from mars.
i like earth!
Hint

Huge input, scanf is recommended.

 
Author
Ignatius.L
 
/*
STL乱搞
*/
#include<bits/stdc++.h>
using namespace std;
string s1,s2;
map<string,string>m;
map<string,string>::iterator it;
char op[];
int main()
{
//freopen("C:\\Users\\acer\\Desktop\\in.txt","r",stdin);
cin>>s1;
//cout<<s1<<endl;
while(cin>>s1)
{
if(s1=="END")
break;
cin>>s2;
//cout<<s1<<" "<<s2<<endl;
m.insert(pair<string,string>(s2,s1));
}
cin>>s1;
//cout<<s1<<endl;
getchar();
while(gets(op))
{
s2=op;
if(s2=="END")
break;
string str="";
for(int i=;i<s2.size();i++)
{
if( !((s2[i]>='a'&&s2[i]<='z')) )//不是字符
{
it=m.find(str);
if(it==m.end())
cout<<str;
else
cout<<m[str];
//cout<<str<<endl;
str="";
cout<<s2[i];
}
else
str+=s2[i];
}
cout<<endl;
}
return ;
}

随机推荐

  1. FixFFmpeg 修改官方编译的ffmpeg能在 XP 上运行的工具

    把 fixff.cmd 和 FixFFmpeg.exe 拷贝到 ffmpeg 所在的目录 运行 fixff.cmd 自动修复; fixffmpeg-20160924.7z

  2. 4&period; UIButton的使用

    1. UIButton的初认识 来自:http://www.cnblogs.com/mcj-coding/p/5103891.html QQ:853740091 1.1 UIButton 是iOS 开 ...

  3. 1019&colon; &lbrack;SHOI2008&rsqb;汉诺塔

    1019: [SHOI2008]汉诺塔 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 1495  Solved: 916[Submit][Status] ...

  4. 文本XSS攻击过滤

    在FCK或百度编辑器等常用富文本编辑器中,通常是会被XSS攻击 处理方法: 文本框模拟输入了以下文本 <span style="dispaly:none" onclick=& ...

  5. 微信video标签全屏无法退出bug 本文系转载

    安卓(android)微信里面video播放视频,会被强制全屏,播放完毕后还有腾讯推荐的视频,非常讨厌..强制被全屏无法解决,但是视频播放完毕后退出播放器可以解决.方法就是视频播放完毕后,用音频aud ...

  6. mysql源码:关于innodb中两次写的探索

    两次写可以说是在Innodb中很独特的一个功能点,而关于它的说明或者解释非常少,至于它存在的原因更没有多少文章来说,所以我打算专门对它做一次说明. 首先说明一下为什么会有两次写这个东西:因为innod ...

  7. linux下使用split 来分割大文件

    linux下使用split 来分割大文件 2010-07-27 15:46:27|  分类: 技术文稿 |  标签:split  分割  linux   |字号 订阅   平常都是使用ssh来进行远程 ...

  8. nodejs调试工具node-inspector入门随笔

    最近打算玩玩node. 众所周知,在前端,调试代码有一众天然好工具——浏览器!特别是 chrome,使得 jser 们如鱼得水,玩得风生水起.但是到了node,情况就不一样了,js 代码不再运行在单纯 ...

  9. js两个日期对比大小

     //适合格式(0000-00-00) //日期比较 function dateCompare(startdata, enddata) { var arr = startdata.split(&quo ...

  10. Jquery moblie中的分栏布局

    大家好,很高兴又与大家见面了,今天我要给大家展示的是自己对jquery  moblie中网格布局的理解.可能不是尽善尽美,希望大家多多体谅! 在jquery moblie中有两种布局,一种是表格布局( ...

上一篇:Python之上下文管理器


下一篇:Python之上下文管理