public static void main(String[] args) {
    Scanner in = new Scanner(System.in);  int m = in.nextInt();  Set<String> sets = new HashSet<String>();  in.nextLine();  for(int i = 0 ; i < m; ++i){
        String str = in.nextLine();  char[] chs = str.toCharArray();  Arrays.sort(chs);  sets.add(new String(chs));  }
    System.out.println(sets.size());    }
思路是一样的 但是我这个AC了