dd = ['a-',['b-',['c','d'],'e-f','d']]
def sss(dd):
dl=[]
print('fff',dd)
for index,var in enumerate(dd):
if isinstance(var,str):
if var.endswith('-'):
print(var)
dl.extend([f'{var}{li}' for li in sss(dd[index+1])])
print(dl)
else:
print('xxx',var)
dl.append(var)
return dl
d1 = sss(dd)
print(d1)