• + 0 comments

    This passes all cases barr 5. Seems to be an issue with test case 5 as others have pointed out.

    public class Solution {
    
     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();
            }
    
    
    
            HashSet<String> strings = new HashSet<String>();
    
            // counter
            int lines = 0;
    
    
            for (int i = 0; i < t; i++){
                String concat = pair_left[i] + " " + pair_right[i];
                
                if(!strings.contains(concat)){
                    strings.add(concat);
                    lines++;
                }
                System.out.println(lines);
    }