fork(1) download
  1. import java.util.*;
  2.  
  3. class Ideone
  4. {
  5. public static int uniqueCount(String str)
  6. {
  7. HashSet<Character> al = new HashSet<Character>();
  8. char[] arr= str.toCharArray();
  9. for (int i=0; i<arr.length; i++)
  10. {
  11. al.add(arr[i]);
  12. }
  13. return al.size() ;
  14. }
  15.  
  16.  
  17. public static void main(String args[])
  18. {
  19. Scanner sc = new Scanner(System.in);
  20. String str = sc.next();
  21. System.out.println(uniqueCount(str));
  22.  
  23. }
  24. }
  25.  
Success #stdin #stdout 0.05s 4386816KB
stdin
aabbccd
stdout
4