Given a string, find the number of different characters in it.
Example
For s = "cabca"
, the output should bedifferentSymbolsNaive(s) = 3
.
There are 3
different characters a
, b
and c
.
我的解答:
def differentSymbolsNaive(s):
return len(set(s))
一模一样
膜拜大佬