how do i fix words composed of duplicate letters?

If letters are duplicated, you can try something like this

for w in text.split():
    if len(w) %2 != 0:
        print(w)
        continue
    if w[0::2] == w[1::2]:
        print(w[0::2])
        continue
    print(w)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top