Strings, Loops
Write a function that takes in a string and returns a string where any repeating characters have been truncated to one character. For example:
>>> truncate('aaaaabbbbbcccaaaa')
'abca'
>>> truncate('hi there')
'hi there'
>>> truncate('hi !!! wooow')
'hi ! wow'
We’ve provided a function stub and tests in truncate-repeats.py.