题解 | #字符个数统计#巧用set
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
import java.util.*;
import java.lang.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
Set<Character> set=new HashSet<>();
String s=sc.nextLine();
int kinds=0;
for(int i=0;i<s.length();i++){
char ch=s.charAt(i);
if(ch>=0 && ch<=127 && !set.contains(ch)){
kinds++;
}
set.add(ch);
}
System.out.println(kinds);
}
}