# 題目: UVa 10282 - Babelfish

# 題目說明

你剛剛移民到一個大城市,這裡的語言對你來說很陌生,幸運的是,你有一個字典
寫一個程式將未知語言翻譯成英文


INPUT:
每一行會有兩個字串,前者代表英文,後者代表未知語言,直到輸入空白
接著重複輸入未知語言


OUTPUT:
將未知語言翻譯成英文輸出,如果字典找不到則輸出eh

# 解題方法

這題主要是熟悉map這個容器,一個key會對應到一個value
建map後,搜尋輸出即可

# 參考程式碼

#include <iostream>
#include <map>
#include <string>
#include <sstream>

using namespace std;

int main()
{
	map<string, string> dict;
	string input, key, value;
	stringstream ss;

	while (getline(cin, input) && input != "") {
		ss.clear();
		ss << input;
		ss >> value >> key;
		dict[key] = value;
	}
	while (getline(cin, input)) cout << (dict.find(input) != dict.end() ? dict[input] : "eh") << endl;

	return 0;
}