-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay16_prob1.java
More file actions
55 lines (44 loc) · 1.25 KB
/
Day16_prob1.java
File metadata and controls
55 lines (44 loc) · 1.25 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
Jasmine and jack created 2 different arrays to store their products which they have purchased from super market. Then they compared their products to identify the count of similar products they have purchased
Input Format
Milk Toy Chair Stool
Stool Bag Watch Milk
Constraints
Create two different String array of size 4
Compare and display the result in integers
Output Format
2
Sample Input 0
Milk Toy Chair Stool
Stool Bag Watch Milk
Sample Output 0
2
*/
// Kirtan Jain
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
int count=0;
String a1[] = new String[5];
String a2[] = new String[5];
for(int i=0;i<4;i++){
a1[i]=sc.next();
}
for(int i=0;i<4;i++){
a2[i]=sc.next();
}
// for(int i=0;i<4;i++){
// System.out.println(a1[i]);
// }
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
if(a1[j].equals(a2[i]))
count++;
}
}
System.out.println(count);
}
}