Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tamask
Created December 14, 2012 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tamask/4287236 to your computer and use it in GitHub Desktop.
Save tamask/4287236 to your computer and use it in GitHub Desktop.
acronym generator
#!/usr/bin/env python
import sys
last = ''
punc = ','
while True:
c = sys.stdin.read(1)
if c:
if c in punc or c.isalpha() and not last.isalpha() and last not in ('\'',):
sys.stdout.write(c.upper())
last = c
else:
sys.stdout.write('\n')
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment