fork download
  1. import re
  2.  
  3. for s in [ "dghnfxjdx", "aaa", "asbfd" ]:
  4. print(re.sub(r'(.+?)\1+', r'\1', s))
Success #stdin #stdout 0.02s 7212KB
stdin
Standard input is empty
stdout
dghnfxjdx
a
asbfd