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. 跟bWAPP学WEB安全(PHP代码)--HTML注入和iFrame注入

    背景 这里讲解HTML注入和iFrame注入,其他的本质都是HTML的改变.那么有人会问,XSS与HTML注入有啥区别呢?其实本质上都是没有区别的,改变前端代码,来攻击客户端,但是XSS可以理解为注入 ...

  2. Xcode - LLDB调试技巧

    LLDB是Xcode默认的调试器,它与LLVM编译器一起,带给我们更丰富的流程控制和数据检测的调试功能.平时用Xcode运行程序,实际走的都是LLDB.熟练使用LLDB,可以让你debug事半功倍. ...

  3. PHP----实现压缩HTML

    很多时候,我们在做优化处理的时候,会考虑压缩HTML,去掉HTML里面的空格和换行. 具体实现: public function change(){ echo "change"; ...

  4. 单引号、双引号、int和char

    首先说一下C语言中用单引号和双引号的不同(一直搞不清楚): 单引号代表的是一个整数,而这个整数的值是编译器所采用的字符集中的字符序列对应的值.所以一般'A'和ASCII中的65意义相同.对于双引号定义 ...

  5. table-layout:fixed 布局注意事项

    table-layout:auto 是表格布局中的默认值,采用浏览器自动表格布局算法,但是缺点会很明显 给td指定的width不一定生效,td的width会自动调整 text-overflow: el ...

  6. 关于 Java 泛型的一些有趣的例子

    有以下的代码: try { ArrayList<String> lstA = new ArrayList<String>(); ArrayList<Integer> ...

  7. SQL Fundamentals || DCL(Data Control Language) || 系统权限&对象权限管理(GRANT&REVOKE)

    SQL Fundamentals || Oracle SQL语言 语句 解释 Create user Creates a user(usually performed by a DBA) Grant ...

  8. Linux:获取当前进程的执行文件的绝对路径

    摘要:本文介绍Linux的应用程序和内核模块获取当前进程执行文件绝对路径的实现方法. 注意:使用此方法时,如果执行一个指向执行文件的链接文件,则获得的不是链接文件的绝对路径,而是执行文件的绝对路径. ...

  9. 【紫书】Tree UVA - 548 静态建树dfs

    题意:给你中序后序 求某叶子节点使得从根到该节点权值和最小.若存在多个,输出其权值最小的那个. 题解:先建树,然后暴力dfs/bfs所有路径,取min 技巧:递归传参数,l1,r1,l2,r2, su ...

  10. A Simple Problem with Integers---poj3468线段树

    http://poj.org/problem?id=3468   题意:有一个比较长的区间可能是100000.长度, 每个点都有一个值(值还比较大), 现在有一些操作: C a b c, 把区间a-- ...