From 9a5541d9274e101e8a767d63ca4439d4de320d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C5=9F=C4=B1nsu=20Ar=C4=B1c=C4=B1?= Date: Wed, 9 Feb 2022 22:46:06 +0300 Subject: [PATCH] 1876 --- E_1876_SubstringsofSizeThreewithDistinctCharacters.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 E_1876_SubstringsofSizeThreewithDistinctCharacters.py diff --git a/E_1876_SubstringsofSizeThreewithDistinctCharacters.py b/E_1876_SubstringsofSizeThreewithDistinctCharacters.py new file mode 100644 index 0000000..de5ace4 --- /dev/null +++ b/E_1876_SubstringsofSizeThreewithDistinctCharacters.py @@ -0,0 +1,8 @@ +class Solution: + def countGoodSubstrings(self, s: str) -> int: + counter=0 + for i in range(len(s)-2): + if len(s[i:i+3]) == len(set(s[i:i+3])): + counter = counter+1 + + return counter \ No newline at end of file