Babelfish
来源:互联网 发布:音乐版权 知乎 编辑:程序博客网 时间:2024/06/05 10:03
/*Babelfish
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*/
//题意:给出一些english和foreign对应的词典,然后是一行空格,接着是一些foreign,要求判断这些
//foreign是否在词典中,若在则输出其对应的english,不在则输出‘eh’
#include<stdio.h>#include<iostream>using namespace std;#include<string>#include<map>int main(){ char english[15],foreign[15]; map<string,bool>s; map<string,string>c; while(true) { char t; if((t=getchar())=='\n') break; else { english[0]=t; int i=1; while(true) { t=getchar(); if(t==' ') { english[i]='\0'; break; } else english[i++]=t; } } scanf("%s",foreign); getchar(); s[foreign]=true; c[foreign]=english; } char a[15]; while(~scanf("%s",a)) { if(s[a]) { //printf("%s\n",c[a]); cout<<c[a]<<endl; } else //printf("eh\n"); cout<<"eh"<<endl; } return 0;}
- Babelfish
- Babelfish
- Babelfish
- Babelfish
- Babelfish
- Babelfish
- Babelfish
- Babelfish
- Babelfish
- Babelfish
- Babelfish
- R - Babelfish
- 10282 - Babelfish(***)
- 【STL】Babelfish
- POJ2503 Babelfish
- Babelfish poj2503
- 10282 - Babelfish
- POJ2503 Babelfish
- 我喜欢这里 我要学习JAVA我喜欢这里 我要学习JAVA
- Unreal Engin_画廊制作笔记 _003<设置贴花在场景中可见>
- PLSQL打开sql文件中文乱码解决方案
- Manacher讲解(及自己的功课笔记)
- Redis之sets类型及操作
- Babelfish
- Euclidean Geometry
- Vue.js
- 设计模式学习之中介者模式
- String 对象方法
- java 字节流与字符流的区别
- 函数调用时的数据传递
- Win7下配置"JAVA环境变量"---JDK的安装与配置 Android studio 安装与升级
- TCP IP协议 三次握手与四次挥手