← Back to challenges

Remove Repeated Letters

PythonHardstringsloops

Instructions

Create a function that replaces all consecutively repeated letters in a word with single letters.

Examples

remove_repeats("aaabbbccc") ➞ "abc"

remove_repeats("bookkeeper") ➞ "bokeper"

remove_repeats("nananana") ➞ "nananana"

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: From A to Z