题解 | #字符个数统计#
截取字符串
http://www.nowcoder.com/practice/a30bbc1a0aca4c27b86dd88868de4a4a
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.hasNextLine()) { String string = scanner.nextLine(); HashSet hashSet = new HashSet<>(); for (char c : string.toCharArray()) { if (c <= 127) { hashSet.add(String.valueOf(c)); } } System.out.println(hashSet.size()); } } }