Commit 7f769e2e authored by root's avatar root

duplicate words

parent d74f15ae
import re
string="He is a boy.Boy he was,was it a truth?"
words=re.split("[\s,\.,\,]+",string)
already_seen=[]
duplicate=[]
for word in words:
if word in already_seen:
duplicate.append(word)
else:
already_seen.append(word)
print duplicate
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment