Babelfish (map 用法。<string, string>
来源:互联网 发布:kali linux 使用教程 编辑:程序博客网 时间:2024/05/16 11:00
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 ogdaycat atcaypig igpayfroot ootfrayloops oopslayatcayittenkayoopslay
Sample Output
catehloops#include<cstdio>#include<cstring>#include<map>#include<string>using namespace std;map<string, string> ma;map<string, string>::iterator it;char str1[11], str2[11], str[22];int main(){ while(gets(str) && str[0]){ sscanf(str,"%s%s", str1, str2); ma[str2] = str1; } while(scanf("%s", str1) != EOF){ it = ma.find(str1); // 用于查找,查找,茶渣 if(it == ma.end()) printf("eh\n"); else printf("%s\n", it->second.c_str()); } return 0;}
1 0
- Babelfish (map 用法。<string, string>
- POJ 2503 Babelfish [map & string]
- (快速查找set,map,string)Babelfish(P2503)
- map和string的用法
- map,string string string string string!!!!!!!!!
- Map.Entry<String,String>
- c++ map<string,string>
- map<string, vector<string> >
- stl几个(set map vector string)用法
- stl几个(set map vector string)用法
- STL几个(set map vector string)用法
- STL几个(set map vector string)用法
- STL几个(set map vector string)用法
- STL基本用法【vector】【map】【string】【set】
- Map<String, Map<String, String>>转String,再转回Map
- poj2240 水题 熟悉map用法及string用法 Frolyd算法
- List<Map<String, String>> 转 Map<String, List<String>>
- Map<String,String> map = new Hash<String,String>
- 黑马程序员-面向对象的基础1
- iOS开发所有KeyboardType与图片对应展示
- @ResponseBody注解 and eval函数
- 《数据结构》实验一: VC编程工具的灵活使用
- Android MediaProvider数据库模式
- Babelfish (map 用法。<string, string>
- SQL Server 检查和处理死锁问题
- ubuntu Android Studio
- ubuntu12.04先编译android2.3.6源代码
- Android中HandlerThread
- IOS ----UIButton用法详解
- Cocos2d-X Box2D中部分方法的重点理解
- C语言中的运算符优先级
- LINUX学习[3]--shell脚本提取文件的文件名、扩展名