마라토너라면 국적과 나이를 불문하고 누구나 참가하고 싶어하는 백준 마라톤 대회가 열린다. 42.195km를 달리는 이 마라톤은 모두가 참가하고 싶어했던 만큼 매년 모두가 완주해왔다. 단, 한 명만 빼고!
모두가 참가하고 싶어서 안달인데 이런 백준 마라톤 대회에 참가해 놓고 완주하지 못한 배부른 참가자 한 명은 누굴까?
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
Map<String, Integer> map = new HashMap<>();
for (int i = 0; i < n; i++) {
String name = br.readLine();
if (map.containsKey(name)) {
map.put(name, map.get(name) + 1);
} else {
map.put(name, 1);
}
}
for (int x = 0; x < n - 1; x++) {
String name = br.readLine();
if (map.containsKey(name)) {
map.put(name, map.get(name) - 1);
}
}
for (Map.Entry<String, Integer> entry : map.entrySet()) {
if (entry.getValue() == 1) {
System.out.println(entry.getKey());
}
}
}
}