fork download
  1. import re
  2. s = 'I love to eat cake'
  3. print( re.sub(r'\s{2,}', lambda x: '-' * len(x.group()), s) )
Success #stdin #stdout 0.03s 9364KB
stdin
Standard input is empty
stdout
I love---to eat----cake