-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path가희와 키워드.java
More file actions
38 lines (27 loc) · 1.01 KB
/
가희와 키워드.java
File metadata and controls
38 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
Map<String, Integer> word = new HashMap<>();
for (int i = 0; i < n; i++) {
String input = br.readLine();
word.put(input, word.getOrDefault(input, 0) + 1);
}
for (int i = 0; i < m; i++) {
String[] str = br.readLine().split(",");
for (String s : str) {
if (word.containsKey(s) && word.get(s) > 0) {
n--;
word.remove(s);
}
}
System.out.println(n);
}
}
}