-
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathSparseArrays.java
More file actions
27 lines (25 loc) · 623 Bytes
/
Copy pathSparseArrays.java
File metadata and controls
27 lines (25 loc) · 623 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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
String s[]=new String[n];
for(int i=0;i<n;i++){
s[i]=sc.next();
}
int q=sc.nextInt();
for(int i=0;i<q;i++){
int count=0;
String c=sc.next();
for(String a:s){
if(a.equals(c))
count++;
}
System.out.println(count);
}
}
}