题解 | #字符个数统计#
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
Set()
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.nextLine(); HashSet<Character> set = new HashSet<>(); for(char c : s.toCharArray()){ if(!set.contains(c)){ set.add(c); } } System.out.println(set.size()); } }