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. linux 安全基本防护 用户提权 ssh访问控制

    linu安全应用 信息安全分类: 物理安全:主机/机房环境 系统安全:操作系统 应用安全:各种网络服务,应用程序 网络安全:网络访问控制,防火墙规则 数据安全:信息的备份与恢复,加密解密 管理安全:保 ...

  2. REALTEK 刷机方法 法

    REALTEK 是通用板最多的IC 方案之一,什么常说的2025 2270 2023 2033 2525 2545 2660 2280 2662 2670 2672 2674  2661  2668 ...

  3. FFmpeg-音频和视频应用程序的瑞士军刀

    FFmpeg是一个开源免费跨平台的视频和音频流方案,属于自由软件,采用LGPL或GPL许可证(依据你选择的组件).它提供了录制.转换以及流化音视频的完整解决方案.它包含了非常先进的音频/视频编解码库l ...

  4. ActiveMQ的运用

    MQ的消息队列模式有2种,一种是点对点模式,一种是订阅模式. 点对点模式:点对点的模式主要建立在一个队列上面,当连接一个列队的时候,发送端不需要知道接收端是否正在接收,可以直接向ActiveMQ发送消 ...

  5. 笔记+R︱风控模型中变量粗筛(随机森林party包)+细筛(woe包)

    每每以为攀得众山小,可.每每又切实来到起点,大牛们,缓缓脚步来俺笔记葩分享一下吧,please~ --------------------------- 本内容来源于CDA-DSC课程内容,原内容为& ...

  6. zTree实现地市县三级级联DAO接口

    zTree实现地市县三级级联DAO接口 ProvinceDao.java: /** * @Title:ProvinceDao.java * @Package:com.gwtjs.dao * @Desc ...

  7. window下实现白天黑夜切换不同桌面

          手机已经具有白天切换白天的壁纸,晚上切换晚上的壁纸的功能,这时候我可以做到白天工作一种心情,晚上休息一种心情.但是苦于电脑一直没有这种功能,于是用vb写下windows可以使用的程序,仅提 ...

  8. 复制粘贴之插件(jquery.zclip.min.js)需要安装flash

    .line{margin-bottom:20px;} /* 复制提示 */ .copy-tips{position:fixed;z-index:999;bottom:50%;left:50%;marg ...

  9. 【原】storm组件(架构层面)

    Strom集群遵循从主模式,主与从之间通过Zookeeper协作.架构层面上包括三个组件: 1) Nimbus Node 2)Supervisor Nodes 3)Zookeeper 其中Nimbus ...

  10. ThreadPoolExecutor线程池参数设置技巧

    一.ThreadPoolExecutor的重要参数   corePoolSize:核心线程数 核心线程会一直存活,及时没有任务需要执行 当线程数小于核心线程数时,即使有线程空闲,线程池也会优先创建新线 ...