Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- ArrayList<Integer> a = new ArrayList<>();
- ArrayList<Integer> b = new ArrayList<>();
- ArrayList<Integer> c = new ArrayList<>();
- int count = 0;
- int a0 = sc.nextInt();
- int a1 = a0;
- while (a1-- > 0) {
- a.add(sc.nextInt());
- }
- int b0 = sc.nextInt();
- int b1 = b0;
- while(b0-- > 0) {
- b.add(sc.nextInt());
- }
- int c0 = sc.nextInt();
- int c1 = c0;
- while(c1-- > 0) {
- c.add(sc.nextInt());
- }
- if (a0 >= b0 && a0 >= c0) {
- for (Integer i : a)
- if (b.contains(i) && c.contains(i))
- count++;
- }
- else if (b0 >= a0 && b0 >= c0) {
- for (Integer i : b)
- if (a.contains(i) && c.contains(i))
- count++;
- }
- else if (c0 >= b0 && c0 >= a0) {
- for (Integer i : c)
- if (a.contains(i) && b.contains(i))
- count++;
- }
- System.out.println(count);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment