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.

Revisions

  1. Vincent Oord created this gist Jun 30, 2015.
    9 changes: 9 additions & 0 deletions anagram.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    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