LearnPy Hub
← Regular Expressions problems
Easy

Collapse Whitespace

Replace every run of whitespace with a single space and strip the ends.

Input

One line.

Output

One line.

Sample 1

Input
  too    many   spaces  
Output
too many spaces

Sample 2

Input
ok
Output
ok
solution.py
Output appears here
Collapse Whitespace · Python practice problem · LearnPy Hub