Skip to content

Instantly share code, notes, and snippets.

@lavie
Last active August 31, 2018 14:27
Show Gist options
  • 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