Feedback for JCF8A problem

Learning course: Learn Advance Java
Problem Link: CodeChef: Practical coding for everyone

Feedback

There are some issue in this question it shows same out again again. fix this bug.

@alokbabu
Its working fine for me plzz refer the following solution for better understanding of the logic.

// Solution as follows
import java.util.*;

class Codechef {
    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        int size = 4;
        
        ArrayList<Integer> list1 = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            list1.add(read.nextInt());
        }
        
        ArrayList<Integer> list2 = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            list2.add(read.nextInt());
        }
        
        Set<Integer> union = new TreeSet<>();
        for (int i = 0; i < list1.size(); i++) {
            union.add(list1.get(i));
        }
        for (int i = 0; i < list2.size(); i++) {
            union.add(list2.get(i));
        }
        
        System.out.println("Union of the lists: " + union);
    }
}