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 ;
}
随机推荐
- 编码格式简介:ASCII码、ANSI、GBK、GB2312、GB18030和Unicode、UTF-8,BOM头
编码格式简介:ASCII码.ANSI.GBK.GB2312.GB18030和Unicode.UTF-8,BOM头 二进制: 只有0和1. 十进制.十六进制.八进制: 计算机其实挺笨的,它只认识0101 ...
- C++ 虚函数 、纯虚函数、接口的实用方法和意义
也许之前我很少写代码,更很少写面向对象的代码,即使有写多半也很容易写回到面向过程的老路上去.在写面向过程的代码的时候,根本不管什么函数重载和覆盖,想到要什么功能就变得法子的换个函数名字,心里想想:反正 ...
- Centos7环境下使用Nginx托管.Net Core应用程序
一.安装.Net Core 参考官方文档:https://www.microsoft.com/net/core#linuxcentos 1.添加dotnet产品Feed 在安装.NET Core之前, ...
- 『诡异的』VL10B创建外向交货单出错解决全过程
一直觉得SAP STO的业务模式配置起来还是挺简单的,无非就是关联一下采购单与交货单的关系,以及相应工厂的装运数据,其他像主数据的设置也没有什么特别的.相比ICS模式,它少了IDOC的配置,所以还是很 ...
- 快速双边滤波 附完整C代码
很早之前写过<双边滤波算法的简易实现bilateralFilter>. 当时学习参考的代码来自cuda的样例. 相关代码可以参阅: https://github.com/johng12/c ...
- bzoj2118(加法原理)(墨墨的等式)
题目大意:给定n个物品,每个物品有一个非负价值,问[L,R]区间内有多少价值可以被凑出来. 题意网上一大片,具体求解过程是利用了加法原理,将各个模数拥有的个数之和相加. 就是说随机取一个数a[k],那 ...
- html表格宽度设置失效
问题描述: 我在写一个网页table时,table宽度超过了我预想的宽度,我想把它设置小一点,但总是没效果.改到怀疑人生!代码如下: 经过多次调试后发现一个问题,table可以改变大小,但是会有一个最 ...
- python --- socket模块详解
socket常用功能函数: socket.socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None) ...
- Chrome Extension in CLJS —— 搭建开发环境
前言 磨刀不误砍柴工,本篇将介绍如何搭建Chrome插件的ClojureScript开发环境. 具体工具栈:vim(paredit,tslime,vim-clojure-static,vim-fir ...
- node-Telnet
什么是Telnet(window系统) 使用Telnet工具作为客户端对创建的TCP服务器进行会话交流时遇到的问题做一个简单的记录.希望可以帮助到一些同学. 这里看一下百度词条的解释 Telnet协议 ...