Skip to content

Instantly share code, notes, and snippets.

@lavie
Last active August 31, 2018 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lavie/f70de8f24cf8ecf578ec7d0390a75537 to your computer and use it in GitHub Desktop.
Save lavie/f70de8f24cf8ecf578ec7d0390a75537 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
words = [line.strip() for line in sys.stdin]
for hay in words:
if len([needle for needle in words if needle in hay]) == 1:
print hay
$ cat old.txt | ./unique.py
old
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment