How would I count consecutive characters in Python to see the number of times each unique digit repeats before the next unique digit?
At first, I thought I could do
This is my simple code for finding maximum number of consecutive 1's in binaray string in python 3:
count= 0 maxcount = 0 for i in str(bin(13)): if i == '1': count +=1 elif count > maxcount: maxcount = count; count = 0 else: count = 0 if count > maxcount: maxcount = count maxcount