Skip to content

Instantly share code, notes, and snippets.

@vindia
Created June 30, 2015 13:52
Show Gist options
  • Save vindia/26e6ceb5f0f52b1d7ce2 to your computer and use it in GitHub Desktop.
Save vindia/26e6ceb5f0f52b1d7ce2 to your computer and use it in GitHub Desktop.
Anagrams! Mans agar! Arm a snag!
sentences = [
'Don’t like this trade.',
'Lets do it in the dark.',
'Foo bar'
]
sentences.each do |sentence|
puts sentence.downcase.gsub!(/[^a-z]/,'').split('').sort!.join('')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment