fork download
  1. import re
  2.  
  3. text = 'my example example example string contains example example some text'
  4.  
  5. text = re.sub(r'\b(\w+)(?:\s+\1)+\b', r'\1', text)
  6.  
  7. print(text)# your code goes here
Success #stdin #stdout 0.07s 64904KB
stdin
Standard input is empty
stdout
my example string contains example some text