Skip to content

Instantly share code, notes, and snippets.

@THEMVFFINMAN
Created May 19, 2016 19:20
Show Gist options
  • Save THEMVFFINMAN/edeb7ce74f938a10212ad4bd2d090d7f to your computer and use it in GitHub Desktop.
Save THEMVFFINMAN/edeb7ce74f938a10212ad4bd2d090d7f to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
import re
def main(argv):
line = sys.stdin.readline()
pattern = re.compile("[a-zA-Z][a-zA-Z0-9]*")
try:
while line:
for word in pattern.findall(line):
print word.lower() + "\t" + "1"
line = sys.stdin.readline()
except "end of file":
return None
if __name__ == "__main__":
main(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment