l = ['w','u','l','y','a','l']
windex = 0
yindex = 0
for i,v in enumerate(l):
if v == 'w':
windex = i
elif v == 'y':
yindex = i
if v == 'u' and (i - windex) == 1:
del l[windex]
if v == 'a' and (i - yindex) == 1:
del l[yindex]
print(l)
arr = ['w', 'u','d','u', '1', 'y', 'a']
d = {'w':'u','y':'a'}
arr = [arr[i] for i in range(len(arr)-1) if arr[i] in d.keys() and arr[i+1] != d[arr[i]] or arr[i] not in d.keys()] + arr[-1:]