题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String st = ""; if(sc.hasNextLine()){ st = sc.nextLine(); } sc.close(); char[] chars = st.toCharArray(); TreeSet<Character> tree = new TreeSet(); for(int i = 0; i<chars.length; i++){ tree.add(chars[i]); } System.out.println(tree.size()); } }