def cnt(s):
    current = [s[0], 1]
out = [current]
for c in s[1:]:
    if c == current[0]:
        current[1] += 1
else:
    current = [c, 1]
out.append(current)
return out
print(cnt('assassin'))
Подсчет последовательных символов в строке