I have to write a program that counts the uniques characters in a String given by the user. For example \"abc\" returns 3 and \"aabbccd\" returns 4. I am not allow to use advan
public static int countUniqueChars (String buf) {
HashSet hash = new HashSet<>();
buf = buf.toUpperCase();
for (int i = 0; i < buf.length(); i++)
hash.add(buf.charAt(i));
return hash.size();
}