map映射查找问题
#include <iostream>
#include <string>
#include <map>
#include <unordered_map>
using namespace std;
int main()
{
int N;
cin >> N;
getchar(); //读取int类型数字后面的换行符
unordered_map<string, string> umap;
while (N--) {
string s;
getline(cin, s);
int pos = s.find(" ");
string s1 = s.substr(0, pos);
umap[s1] = s;
}
int M;
cin >> M;
while (M--) {
string s;
cin >> s;
if (umap.find(s) == umap.end()) {
cout << "No Answer!" << endl;
}
else {
cout << umap[s] << endl;
}
}
return 0;
}