字符个数统计
字符个数统计
http://www.nowcoder.com/questionTerminal/eb94f6a5b2ba49c6ac72d40b5ce95f50
import java.util.Scanner; import java.util.Set; import java.util.HashSet; public class Main { public Main() { Scanner in = new Scanner(System.in); String input = in.next(); Set<Character> set = new HashSet<>(); for (char ch : input.toCharArray()) { if (ch >= 0 && ch < 128) { set.add(ch); } } System.out.println(set.size()); } public static void main(String[] args) { Main solution = new Main(); } }