还是利用HashSet的特性,和HJ9差不多的思路
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
HashSet<Character> hs = new HashSet<>();
StringBuffer bf = new StringBuffer(sc.nextLine());
int sum = 0;
for(int i = 0 ; i < bf.length(); i++){
if(hs.add(bf.charAt(i)))
sum++;
}
System.out.println(sum);
}
}
}