Skip to content

Commit

Permalink
Script for figuring out anagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
robmiller committed Jan 7, 2016
1 parent f23ba23 commit 8047a27
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/anagram
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env ruby

input = ARGV[0]
input_sorted = input.chars.sort.join

File.foreach("/usr/share/dict/words") do |word|
if word.chomp.chars.sort.join == input_sorted
puts word
end
end

0 comments on commit 8047a27

Please sign in to comment.