30 lines
927 B
Java
30 lines
927 B
Java
import java.util.*;
|
|
|
|
public class _1620 {
|
|
public static void main(String[] args){
|
|
Scanner sc = new Scanner(System.in);
|
|
String[] num = sc.nextLine().split(" ");
|
|
int N = Integer.parseInt(num[0]);
|
|
int M = Integer.parseInt(num[1]);
|
|
|
|
Map<Integer, String> pokeDoc1 = new HashMap<>();
|
|
Map<String, Integer> pokeDoc2 = new HashMap<>();
|
|
for(int i=0; i<N; i++){
|
|
String pokeName = sc.nextLine();
|
|
pokeDoc1.put(i+1, pokeName);
|
|
pokeDoc2.put(pokeName, i+1);
|
|
}
|
|
|
|
for(int i=0; i<M; i++) {
|
|
String quest = sc.nextLine();
|
|
char ch = quest.charAt(0);
|
|
if('0' <= ch && ch <= '9'){
|
|
System.out.println(pokeDoc1.get(Integer.parseInt(quest)));
|
|
}
|
|
else {
|
|
System.out.println(pokeDoc2.get(quest));
|
|
}
|
|
}
|
|
sc.close();
|
|
}
|
|
} |