Pages

Monday, September 29, 2014

Are there any words in the English language that use at least half of the alphabet without repeating any letters?

$ cat /usr/share/dict/words | egrep '^\w{13,}$' | egrep -iv '(\w).*\1'

This is the most straightforward approach: first regexp limits dictionary file to words with thirteen or more characters, second regexp discards any words that have a letter repeated. (Bonus challenge: Try doing it in a single regexp!)




commandlinefu.com


by David Winterbottom (codeinthehole.com)






from All commands http://ift.tt/1sKg2PG

No comments:

Post a Comment