• + 0 comments

    The issue with test case 6 is how the problem is formulated:

    The original problem statement says that order matters, but test case 6 behaves as if order does not matter.

    public class Solution {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        Set<String> set = new HashSet<>();
        for (int i = 0; i < t; i++) {
            String a = sc.next();
            String b = sc.next();
            String key = (a.compareTo(b) <= 0) ? (a + " " + b) : (b + " " + a);
            set.add(key);
            System.out.println(set.size());
        }
    }
    

    }