题目链接:https://ac.nowcoder.com/acm/contest/558/B
import java.util.HashSet; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner reader=new Scanner(System.in); HashSet set=new HashSet(); int N=reader.nextInt(); int M=reader.nextInt(); reader.nextLine(); String str[]=new String[N]; for(int i=0;i<N;i++){ str[i]=reader.nextLine(); set.add(str[i]); } System.out.println(set.size()); } }