P1184高手之在一起

    科技2022-09-04  131

    `package 普及减;

    import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class P1184 {

    public static void main(String[] args) { Scanner sc = new Scanner(System.in); Integer n=sc.nextInt(); Integer m=sc.nextInt(); String str1[]=new String[n]; String str2[]=new String[m]; sc.nextLine(); Set<String> set = new HashSet<>(); for(int i=0;i<n;i++) { str1[i]=sc.nextLine(); set.add(str1[i]); } int count=0;

    // for(int i=0;i<m;i++) { // str2[i]=sc.nextLine(); // for(int j=0;j<n;j++) { // if(str2[i].equals(str1[j])) { // count++; // break; // } // } // } for(int i=0;i<m;i++) { if(set.contains(sc.nextLine())) { count++; } } System.out.println(count); }

    } `

    Processed: 0.009, SQL: 9