-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 James Koppel wrote: > I found this Quiz to be extremely easy. I wrote this solution in a > minute or two: > > dict = File.open("wordlist.txt"){|f| f.readlines.reject {|word| > ('A'..'Z') === word[0,1]}} > > base = ARGV[0].to_i > > puts dict.select{|word| word.unpack("C*").select{|char| > char > ?a+base-11}.empty?} Indeed. Here's my two-liner. ARGV[0] is the base to be used, ARGV[1] is the file to be processed. p = /^[#{"0123456789abcdefghijklmnopqrstuvwxyz"[0...ARGV[0].to_i]}]+$/i puts File.open(ARGV[1]).readlines.reject!{|l| l !~ p} I do not reject words that contain digits. That would reject valid Internet slang like "l8er" or "gn8", leetspeak like "1337" or "H4X0R", and acronyms like I18N or L10N. Josef 'Jupp' Schugt - -- Blog available at http://www.mynetcologne.de/~nc-schugtjo/blog/ PGP key with id 6CC6574F available at http://wwwkeys.de.pgp.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFGtfavrhv7B2zGV08RAg8MAJ0a592lTGVyH636SdZzcK8qDP3AogCgnIBZ +CcWYwTWoMIP7XmSwqYG3OE= =rKWG -----END PGP SIGNATURE-----