Skip to content

Instantly share code, notes, and snippets.

@weskerfoot
Created October 26, 2021 05:08
Show Gist options
  • Save weskerfoot/cc385d4c5159b052eeebef5931edcbdb to your computer and use it in GitHub Desktop.
Save weskerfoot/cc385d4c5159b052eeebef5931edcbdb to your computer and use it in GitHub Desktop.
from itertools import zip_longest
def convert(st):
pairs = zip_longest(st, st[1:])
for c, n in pairs:
if c == "e" and n != "e":
yield "va"
elif c == "e" and n == "e":
yield c
yield c
next(pairs)
else:
yield c
print("".join(convert("hello ee blah this is a test weekly wee")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment