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 |
Sample Output
hello, i'm from mars. 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 ;
}
随机推荐
- FoxOne---一个快速高效的BS框架--数据访问(Dao)
FoxOne---一个快速高效的BS框架--(1) FoxOne---一个快速高效的BS框架--(2) FoxOne---一个快速高效的BS框架--(3) FoxOne---一个快速高效的BS框架-- ...
- appium python andiroid自动化文档整理笔记
from appium import webdriver import time,unittest,HTMLTestRunner class Testlogin(unittest.TestCase): ...
- GCD之并行串行区别
1.用户自定义线程队列,创建时很容易创建 注意创建时的第一个参数:标记值,方便调试查看 1 2 dispatch_queue_t serialqueue=dispatch_queue_create(& ...
- 云计算之openstack ocata 项目搭建详细方法
之前写过一篇<openstack mitaka 配置详解>然而最近使用发现阿里不再提供m版本的源,所以最近又开始学习ocata版本,并进行总结,写下如下文档 OpenStack ocata ...
- jenkins~集群分发功能和职责处理
jenkins的多节点集群 在进行自动化部署时,你可以按着它们的项目类型去进行分别部署,这样即可以达到负载均衡,又可以达到一种职责的明确,比如像java的项目你可以使用linux服务来进行部署(拉代码 ...
- IE兼容
这个基本知识http://www.cnblogs.com/yoosou/archive/2012/07/27/2612443.html 参考: http://www.cnblogs.com/cocow ...
- unserialize() [function.unserialize]: Error at offset
$a = 'a:1:{i:0;s:12:"1,10,93,";}'; var_dump( unserialize( $a ) ); 运行之后页面上显示Notice: unseria ...
- ConvertUtils.register注册转换器
当用到BeanUtils的populate.copyProperties方法或者getProperty,setProperty方法其实都会调用convert进行转换 但Converter只支持一些基本 ...
- [#1] YCbCr与RGB的转换公式
1 YCbCr简介 YCbCr颜色空间是将RGB颜色空间进行坐标转换后得到的,常用于数字电视系统.Y取值范围:16~235 Cb.Cr的取值范围:16~240 YCbCr经常和YUV混淆.两者的主要差 ...
- ABAP 数值四舍五入函数
VALUE '12.5445' , dat1 . VALUE '12.540'. * 方法一 CALL FUNCTION 'HR_NZ_ROUNDING_DECIMALS' EXPORTING val ...