Code Signal_练习题_differentSymbolsNaive

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

Example

For s = "cabca", the output should be
differentSymbolsNaive(s) = 3.

There are 3 different characters ab and c.

我的解答:

def differentSymbolsNaive(s):
    return len(set(s))
一模一样
膜拜大佬

猜你喜欢

转载自www.cnblogs.com/YD2018/p/9490656.html