Strings, Loops
def truncate(string):
"""Truncate repeating characters in a string."""
# START SOLUTION
result = []
for ch in string:
if not result or ch != result[-1]:
result.append(ch)
return ''.join(result)