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 其实用cin输入输出也可以
map<T,T>dd;
以及gets(a)与sscanf(a,"%s",str)配合用法;
a为char a[45];
#include<cstdio>
#include<string>
#include<iostream>
#include<map>
using namespace std; int main()
{ map<string,string>dic;
char a[],b[];
int i=;
char str[];
while(gets(str))
{
if(str[]=='\0'){break;}
sscanf(str,"%s %s",a,b);
dic[b]=a;
}
char c[];
string qq;
while(scanf("%s",c)!=EOF)
{
string s=c;
qq=dic[s];
if(qq.length()==)cout<<"eh"<<endl;
else cout<<qq<<endl; } return ;
}

poj 2503 查字典的更多相关文章

  1. poj 2503 Babelfish(字典树或着STL)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 35828   Accepted: 15320 Descr ...

  2. poj 2503 Babelfish(字典树或map或哈希或排序二分)

    输入若干组对应关系,然后输入应该单词,输出对应的单词,如果没有对应的输出eh 此题的做法非常多,很多人用了字典树,还有有用hash的,也有用了排序加二分的(感觉这种方法时间效率最差了),这里我参考了M ...

  3. RY哥查字典

    时间限制: 1 s 空间限制: 16000 KB 题目等级 : 钻石 Diamond 题目描述 Description RY哥最近新买了一本字典,他十分高兴,因为这上面的单词都十分的和谐,他天天查字典 ...

  4. Codevs 2875 RY哥查字典

    时间限制: 1 s  空间限制: 16000 KB  题目等级 : 钻石 Diamond  题目描述 Description RY哥最近新买了一本字典,他十分高兴,因为这上面的单词都十分的和谐,他天天 ...

  5. codevs2875RY哥查字典

    题目链接:http://codevs.cn/problem/2875/ 题目描述 Description RY哥最近新买了一本字典,他十分高兴,因为这上面的单词都十分的和谐,他天天查字典. 输入描述 ...

  6. 题解报告:poj 2503 Babelfish(map)

    Description You have just moved from Waterloo to a big city. The people here speak an incomprehensib ...

  7. POJ 2503 字典树

    题目链接:http://poj.org/problem?id=2503 题意:给定一个词典,输入格式为[string1' 'string2]  意思是string2的值为string1. 然后给定一波 ...

  8. poj 2503 Babelfish(Map、Hash、字典树)

    题目链接:http://poj.org/bbs?problem_id=2503 思路分析: 题目数据数据量为10^5, 为查找问题,使用Hash或Map等查找树可以解决,也可以使用字典树查找. 代码( ...

  9. poj 2503:Babelfish(字典树,经典题,字典翻译)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 30816   Accepted: 13283 Descr ...

随机推荐

  1. Pokémon Go呼应设计:让全世界玩家疯狂沉迷

    引言:什么样的呼应设计会让移动游戏玩家沉迷?那必须为玩家构建一个属于玩家本人或者被玩家认可的虚拟环境,或者说是被玩家认可的虚拟世界.在移动游戏时代,想要做到这一点并不容易.但Pokémon Go却做到 ...

  2. DM6446 uboot分析

    1. 顶层目录下的Makefile 按照配置顺序: davinci_config :    unconfig @./mkconfig $(@:_config=) arm arm926ejs davin ...

  3. 【转载】Ubuntu Android开发环境搭配

    Ubuntu Android开发环境搭配     安装Ubuntu Android应用程序开发环境需要如下几个软件 Java开发包:JDK 1.5/1.6 开发集成环境(IDE): Eclipse 3 ...

  4. Microsoft+R:Microsoft R Open (MRO)安装和多核运作

    每每以为攀得众山小,可.每每又切实来到起点,大牛们,缓缓脚步来俺笔记葩分享一下吧,please~ --------------------------- 本文转载于公众号大猫的R语言课堂,公众号作者使 ...

  5. HI3531ARM调试printf的实现

    void UART_Putc(char c) {     if (c == '\n')   *(unsigned int *)(UART0_ADDR  + 0X00) =  '\r';     del ...

  6. IE浏览器因缓存问题未能成功向后端发送请求的几个解决办法

    这段时间前后端联调,解决IE.谷歌等浏览器兼容问题,真是让人有点焦头烂额,各种奇葩问题层出不穷,旧问题刚去,新麻烦又来,其中尤其以IE浏览器缓存的问题最多.有若干次都是因为这个缓存,使得前端的请求没有 ...

  7. 判断一个jquery对象是否为空

    今天用jquery $获取一个jquery对象.$("#id") 然后用判断这个对象是否存在,id不存在的时候,判断这个是否存在, if($("#id")) 始 ...

  8. 【html5】html学习笔记1

    html5语法规则 1.标签要小写 2.省略标签 如 <tr> <td> <tr><td> 3.属性不加” 如 <div  id=div1> ...

  9. stm32开发之使用Keil MDK以及标准外设库创建STM32工程

    ‑6 MDK详细版本信息 ‑8保存路径的选择 ‑9选择芯片型号 ‑10拷贝启动代码选择 ‑11选择 Manage Comoonents ‑12编辑组并添加对应文件 ‑13工程管理文件列表 ‑14选择进 ...

  10. Struts2实现文件上传报错(二)

    1.具体报错如下 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -he ...