Unique Character Count

This kind of check is useful when you want to measure how much variety a string contains, such as how many different letters or symbols appear in a text. Write a function count_distinct that counts only the unique characters in s. Case matters: "A" and "a" are considered different characters.

Примеры

Ввод
"hello"
Вывод
4
Ввод
"aaaa"
Вывод
1
Ввод
"abcABC"
Вывод
6

Нужно реализовать

def count_distinct(s: str) -> int:

Теги

stringssethashmap
PostgreSQLv16

Hawn jidher ir-riżultat tat-tħaddim tal-kodiċi

Visible tests
1
Input
"hello"
Expected4
2
Input
"aaaa"
Expected1
3
Input
"abcABC"
Expected6
4
Input
""
Expected0
5
Input
"a b c"
Expected4
6
Input
"mississippi"
Expected4
Focus radio
Paused · SomaFM · Fluid