<reponame>wyaadarsh/LeetCode-Solutions<filename>Python3/0696-Count-Binary-Substrings/soln.py<gh_stars>1-10
class Solution:
    def countBinarySubstrings(self, s):
        """
        :type s: str
        :rtype: int
        """
        cnts = [len(list(g)) for key, g in itertools.groupby(s)]
        return sum(min(a, b) for a, b in zip(cnts, cnts[1:]))
class Solution:
    def countBinarySubstrings(self, s):
        """
        :type s: str
        :rtype: int
        """
        cnts = [len(list(g)) for key, g in itertools.groupby(s)]
        return sum(min(a, b) for a, b in zip(cnts, cnts[1:]))
:type s: str         :rtype: int