-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path문자열 집합.java
More file actions
30 lines (25 loc) · 855 Bytes
/
문자열 집합.java
File metadata and controls
30 lines (25 loc) · 855 Bytes
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
// 문자열 집합
import java.util.*;
import java.lang.*;
import java.io.*;
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> s = new HashMap<>();
for (int i = 0; i < n; i++) {
String line = br.readLine();
s.put(line, s.getOrDefault(line, 0) + 1);
}
int cnt = 0;
for (int i = 0; i < m; i++) {
String line = br.readLine();
if (s.containsKey(line)) {
cnt++;
}
}
System.out.println(cnt);
}
}