링크 : https://www.acmicpc.net/problem/1620
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
ios_base::sync_with_stdio(false);
cin.tie(0);
map<string, int> m;
vector<string> name;
for(int i = 0; i < N; i++){
string tmp = "";
cin >> tmp;
m.insert(make_pair(tmp, i+1));
name.push_back(tmp);
}
int cnt = 0;
for(int i = 0 ; i < M; i++){
string tmp = "";
cin >> tmp;
if( isdigit(tmp[0]) != 0 ){
cout << name[stoi(tmp) - 1] << '\n';
}
else{
cout << to_string(m[tmp]) << '\n';
}
}
return 0;
}