Ruby - counting number of string occurence in a string/array : This code returns the word with the most occurences in a given string. But, it's not working if there's for exemple two string equals to the max.  
For exemple, if i was adding 3 'cool' to the text, it would still
return :

    The words with the most frequencies is 'really' with 
    a frequency of 4.

Even if cool is also equal to 4.


    t1 = "This is a really really really cool experiment cool really "



    
     frequency = Hash.new(0) 
     words = t1.split					  
     words.each { |word| frequency[word.downcase] += 1 } 
     frequency = frequency.map.max_by {|k, v| v }
     puts "The words with the most frequencies is '#{frequency[0]}' with 
     a frequency of #{frequency[1]}."




i'm expecting to be able to return all word(s) with the max occurences 
from a given string. 

It would be nice if you guys could tell me if those method would work on a array too instead of a string because im still learning that some methods wont work on different type of data and i might have to use this code on arrays.

Thanks !

