题目
解法
import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); while(scanner.hasNext()){ String input = scanner.nextLine(); HashSet<Character> set = new HashSet<>(); for(int i=0;i<input.length();i++){ if(input.charAt(i) >= 0 && input.charAt(i) <= 127 ){ set.add(input.charAt(i)); } } System.out.println(set.size()); } } }