题解 | #字符个数统计#
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
import java.util.Scanner;
import java.util.HashSet;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String str = sc.next();
char[] c = str.toCharArray();
HashSet hs = new HashSet();
for(int i = 0;i<c.length;i++){
hs.add(c[i]);
}
System.out.println(hs.size());
}
}
}
import java.util.HashSet;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String str = sc.next();
char[] c = str.toCharArray();
HashSet hs = new HashSet();
for(int i = 0;i<c.length;i++){
hs.add(c[i]);
}
System.out.println(hs.size());
}
}
}