菜菜

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

题意:语言翻译,

直接map即可

#include "pch.h"
#include <string>
#include<iostream>
#include<map>
#include<memory.h>
#include<vector>


namespace cc
{
	using std::cout;
	using std::endl;
	using std::cin;
	using std::map;
	using std::vector;
	using std::string;


	constexpr int N = 100000;

	string eh = "eh";
	
	map<string, string>strMaps;
	void solve()
	{
		string str;
		int k = 0;
		while (getline(cin, str))
		{
			if (str.size() == 0)
				break;
			int index = str.find(" ");
			string str1 = str.substr(0,index);
			string str2 = str.substr(index+1);
			strMaps[str2] = str1;
		}

		using IT = map<string, string>::iterator;
		while (getline(cin, str))
		{
			IT it  = strMaps.find(str);
			if (it == strMaps.end())
				cout << eh << endl;
			else
				cout << it->second << endl;
		}

	}

};


int main()
{

#ifndef ONLINE_JUDGE
	freopen("d://1.text", "r", stdin);
#endif // !ONLINE_JUDGE
	cc::solve();

	return 0;
}

  

posted on 2018-11-04 00:17  好吧,就是菜菜  阅读(127)  评论(0编辑  收藏  举报