fork download
  1. import re
  2.  
  3. text = "contentment and maintaining are such words"
  4. print ( [x.group() for x in re.finditer(r'\b(?=\w*(\w{2})(?:\w*\1){2})\w+', text)] )
  5. print ( len([x.group() for x in re.finditer(r'\b(?=\w*(\w{2})(?:\w*\1){2})\w+', text)]) )
Success #stdin #stdout 0.02s 9676KB
stdin
Standard input is empty
stdout
['contentment', 'maintaining']
2