Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
747 B
2
Indexable
Never
package JavaTest2;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class HashSetPair {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int t = s.nextInt();
        String[] pair_left = new String[t];
        String[] pair_right = new String[t];

        for (int i = 0; i < t; i++) {
            pair_left[i] = s.next();
            pair_right[i] = s.next();
        }
        Set<String> pairs = new HashSet<>();
        int pairCount = 0;
        for (int i = 0; i < t; i++) {
            pairs.add(pair_left[i] + " " + pair_right[i]);
            pairCount = pairs.size();
            System.out.println(pairCount);
        }

    }
}
Leave a Comment