x = [0,99, 'a', 1, 2, 'b',5, 3, 0,'a' ,1, 8, 5,'b',5,9,5]
b=[]
c=[]
d=[]
for i in range(len(x)):
if 'a'==x[i]:
b.append(i)
elif 'b'==x[i]:
c.append(i)
print(b)
print(c)
if len(b)==len(c):
for i in range(len(b)):
d.append(x[b[i]:c[i]])
print(d)