res = []
while i < len(s):
    j = i + 1
while j < len(s) and s[i] == s[j]:
    j += 1
res.append((s[i], j - i))
i = j
return res
Count of repeated characters including the non-repeated ones in a string python