defcountGoodSubstrings(self, s):"""
:type s: str
:rtype: int
"""
n =0for i inrange(len(s)-2):if s[i]!= s[i+1]and s[i+1]!= s[i+2]and s[i]!= s[i+2]:
n +=1return n
1876.长度为三且各字符不同的子字符串 def countGoodSubstrings(self, s): """ :type s: str :rtype: int """ n = 0 for i in range(len(s)-2): if s[i] != s[i+1] and s[i+1] != s[i+2] and s[i] != s[i+2]: