Given a string, find the number of different characters in it.

Example

For s = "cabca", the output should be

solution(s) = 3.

There are 3 different characters ab and c.

Input/Output

풀이

int solution(String s) {
    HashSet <Character> set = new HashSet<>();
    
    for (char c : s.toCharArray()) {
        set.add(c);
    }
    
    return set.size();
}