문제
https://www.acmicpc.net/problem/17219
코드
import java.util.*;
import java.io.*;
class Main {
public static void main(String args[]) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
StringBuilder sb = new StringBuilder();
HashMap<String, String> hash = new HashMap<>();
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
for(int i=0;i<n;i++) {
st = new StringTokenizer(br.readLine());
String site = st.nextToken();
String password = st.nextToken();
hash.put(site, password);
}
for(int i=0;i<m;i++) {
String site = br.readLine();
sb.append(hash.get(site)).append("\n");
}
System.out.print(sb);
}
}