Skip to content

Instantly share code, notes, and snippets.

@t-oginogin
Created March 30, 2014 21:32
Show Gist options
  • Save t-oginogin/9880207 to your computer and use it in GitHub Desktop.
Save t-oginogin/9880207 to your computer and use it in GitHub Desktop.
    def count_word( input )
      words = Hash.new(0)
      input_words = input.split(' ')
    
      input_words.each do |word|
        words[word] += 1
      end
    
      words
    end
    
    input = gets
    p count_word(input)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment