# 连续抛1000次硬币 打印出连续出现4次0的次数 连续出现8次1的次数
# 举例:10000111000010 打印出2
import random
num = 1
lst = []
while num<=1000:
lst.append(random.randint(0, 1))
num+=1
x=1
lst1=[]
for i in range(1,1000):
if lst[i-1]==lst[i]:
x+=1
else:
x=1
lst1.append(x)
print(lst1)
y=0
for i in lst1:
if i==4:
y+=1
print(y)