> Making an form of an anagram solver. My approach would be the code > listed below but there has to be a cleaner way to do it. > > puts "Word: " > word = gets.chomp > res = word.split('') require 'facet/enumerable/permutation' res.each_permutation do |perm| puts perm.join end (You'll need to install facets first - gem install facets) > As you can imagine this would take me a ridiculous amount of time for > words that are 7 characters or longer... And you're going to get just as much output. You're probably best iterating over a dictionary word list rather than iterating over the possible word list. A 12 letter word is going to have 1/2 a billion possible permutations, but you'll struggle to find a dictionary with much more than 1/2 million actual words. Dan.