Learn how to remove extra spaces from a string using regex, string splitting, a fixed point, and itertools.groupby.
itertools.groupby
There should be no such thing as boring mathematics.