求助python,找不到错误点,就20分
lst1 = []
lst2=[]
lst3=[]
a=0
b=0
while True:
try:
line = input()
if not line:
break
lst1.append(line)
except EOFError:
break
n=len(lst1)
lst3.append(n)
for i in lst1:
for j in range(len(i)):
lst2.append(i[j])
c=lst2.index('0')
for i in range(c,len(lst2)):
if lst2[i] == '0':
if b!=0:
lst3.append(b)
b=0
a+=1
elif lst2[i]=='1':
if a!=0:
lst3.append(a)
a=0
b+=1
if a != 0:
lst3.append(a)
elif b != 0:
lst3.append(b)
print(' '.join(map(str,lst3)))