poj 2503 查字典

简介: Description You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language.

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[11],b[11];
    int i=0;
 char str[21];
    while(gets(str))
    {
      if(str[0]=='\0'){break;}
      sscanf(str,"%s %s",a,b);
     dic[b]=a;
    }
    char c[11];
 string qq;
    while(scanf("%s",c)!=EOF)
        {
             string s=c;
           qq=dic[s];
           if(qq.length()==0)cout<<"eh"<<endl;
           else cout<<qq<<endl;

        }

    return 0;
}

 

相关文章
|
存储 运维 监控
物联网平台常见类别及对应平台(一)
物联网平台常见类别及对应平台(一)
2696 21
|
数据中心
网络之脉:深入解析CAT-5与CAT-5e
【4月更文挑战第21天】
2632 0
|
弹性计算 Linux Go
如何在阿里云ecs服务器之间高效内网传输大文件
阿里云ecs服务器之间大文件迁移利用阿里云oss通过内网传输解决方案
4100 0
如何在阿里云ecs服务器之间高效内网传输大文件
|
数据采集 人工智能 文字识别
RAG 检索增强生成详解:从原理、架构到企业知识库落地全流程(2026 实战)
RAG(检索增强生成)让大模型答题前先 "翻资料",把知识和组织语言解耦。本文从 2020 年 Meta 与斯坦福提出的原论文讲起,拆解完整链路:文档切块、嵌入、向量库、Top-K 召回、重排、Prompt 拼装;给出 RAG 与微调、提示词工程的对比表和企业落地五步,并讲清它抑制幻觉 30%-50% 的原理与常见坑。
|
7天前
|
机器学习/深度学习 弹性计算 缓存
Qwen4-Max 首发上线 ,Token Plan 低至5折
阿里云发布Qwen4-Max:2.4万亿参数旗舰模型,采用MoE稀疏架构,实测仅激活71B参数,推理成本降58%。主打长上下文、智能体与编程任务,配合百炼Token Plan新客5折(低至19.5元/月),推动大模型从“奢侈品”变为开发者基础设施。(239字)
190 0
|
11月前
|
数据采集 API 调度
Python异步编程入门:告别“等待”的艺术
Python异步编程入门:告别“等待”的艺术
504 136
|
5月前
|
安全 芯片 iOS开发
OpenClaw怎么安装部署(TopClaw中文版windwos10/11、mac安装包搭建教程)
本文详解OpenClaw与中文汉化版TopClaw的安装部署:对比原版繁杂配置,TopClaw实现Windows/macOS一键安装、三分钟上手,兼容新老系统,内置优化与安全防护,真正让技术小白零门槛用上专业工具。
417 1
|
4月前
|
人工智能 安全 UED
刚刚,阿里悄悄上线了他们最新视频模型:Wan3.0【附10种神仙玩法】
1080P 30秒视频!打骨折价,AI视频终于卷起来啦~
837 0
|
缓存 前端开发 Java
深入理解 Java 类加载器:双亲委派机制的前世今生与源码解析
本文深入解析Java类加载器与双亲委派机制,从Bootstrap到自定义加载器,剖析loadClass源码,揭示类加载的线程安全、缓存机制与委派逻辑,并探讨SPI、Tomcat、OSGi等场景下打破双亲委派的原理与实践价值。(238字)
1249 8
深入理解 Java 类加载器:双亲委派机制的前世今生与源码解析
|
12月前
|
网络协议 安全 数据挖掘
阿里云服务器九代实例c9i/g9i/r9i与c9a/g9a/r9a对比,性能、价格、适用场景对比与选择参考
目前在阿里云的活动中,除了入门级的轻量应用服务器和经济型e实例,主打高性价比的通用算力型实例云服务器之外,对于需要高性能云服务器的用户,可选择活动内的九代云服务器c9i/g9i/r9i实例和c9a/g9a/r9a实例,本文为大家介绍c9i/g9i/r9i实例和c9a/g9a/r9a实例的架构、处理器、适用场景与价格,以供大家对比和选择参考。
1937 9