Last active
December 15, 2015 18:59
-
-
Save michaelnugent/5307736 to your computer and use it in GitHub Desktop.
Anagram problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| File.open("/usr/share/dict/words") do |handle| | |
| cachedsorted = ARGV[0].chars.sort | |
| handle.each_line do |word| | |
| puts word if word.strip.chars.sort == cachedsorted | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment