Description

You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.

Input

Input consists of up to 100,000 dictionary entries, followed by a blank line, followed by a message of up to 100,000 words. Each dictionary entry is a line containing an English word, followed by a space and a foreign language word. No foreign word appears more than once in the dictionary. The message is a sequence of words in the foreign language, one word on each line. Each word in the input is a sequence of at most 10 lowercase letters.

Output

Output is the message translated to English, one word per line. Foreign words not in the dictionary should be translated as "eh".

Sample Input

dog ogday
cat atcay
pig igpay
froot ootfray
loops oopslay atcay
ittenkay
oopslay

Sample Output

cat
eh
loops

Hint

Huge input and output,scanf and printf are recommended.
#include<map>
#include<cstdio>
#include<iostream>
#include<string>
using namespace std;
int main()
{
map<string,string> m;
string s;
while(getline(cin,s)){
if(s.empty()) break;
int p,sz=s.size();
p=s.find(' ');
string a=s.substr(,p);
string b=s.substr(p+,sz-p-);
m[b]=a;
}
string t;
while(cin>>t){
if(!m[t].empty())
cout<<m[t]<<endl;
else cout<<"eh"<<endl;
}
}

PKU2503_map应用的更多相关文章

随机推荐

  1. sencha touch Demo(示例)(2014-6-25)

    这是一个开源示例,是我对sencha touch的深层应用.已停止更新 sencha touch版本:2.2.1/2.3.1 源码地址: https://bitbucket.org/moLangZai ...

  2. CentOS 添加环境变量

      1.修改环境变量需要修改/etc/profile export PATH="$PATH:/usr/src/ruby-1.9.3-p0/ruby:/usr/local/bin/gem&qu ...

  3. 【CF888E】Maximum Subsequence 折半搜索

    [CF888E]Maximum Subsequence 题意:给你一个序列{ai},让你从中选出一个子序列,使得序列和%m最大. n<=35,m<=10^9 题解:不小心瞟了一眼tag就一 ...

  4. [工具] Sublime Text 使用指南

    http://bbs.it-home.org/thread-46291-1-1.html 摘要(Abstract) 更新记录 更正打开控制台的快捷键为Ctrl + ` 更正全局替换的快捷键为Ctrl ...

  5. JAVA基础知识点转载

    JAVA部分: 1.Java 指定线程执行顺序(三种方式) 转载link:https://blog.csdn.net/difffate/article/details/63684290 2.jdk7中 ...

  6. 被included或者被required的文件都来自哪里呢

    过PHP,你可以使用不同函数帮助你重用代码.具体用到的函数取决于你打算重用的内容. 主函数如下: * include() and include_once() * require() and requ ...

  7. ELK(使用RPM包安装配置ELK)

    1,安装环境查看 2,下载rmp包 下载地址:https://www.elastic.co/cn/downloads 分别下载最新rmp包 elasticsearch-6.2.4.rpm logsta ...

  8. 寻找 IBatisNet 批量插入(批量复制) 的心路历程

    1.IBatisNet本身就是一个比较早的ORM框架,再加上是从java iBatis移值过来的,其流行程度不是特别高资料也不是很多(一年前),不过最近好像搜索比较多了一些(可能是训练的结果吧) 2. ...

  9. 【转】JavaScript prototype

    原文地址:http://www.cnblogs.com/dolphinX/p/3286177.html 用过JavaScript的同学们肯定都对prototype如雷贯耳,但是这究竟是个什么东西却让初 ...

  10. 【转】JavaScript中的匿名函数及函数的闭包

    对闭包理解一直不甚明了,在此特转摘博文一篇以备查用. 原文地址:http://www.cnblogs.com/rainman/archive/2009/05/04/1448899.html 相关文章: ...