[Solved] Comparing a string with an array of strings and printing the count


array.count(mystring)

["Cat", "Dog", "Cat"].count("Cat") #=> 2

["Cat", "Dog", "Cat"].count("Dog") #=> 1

4

solved Comparing a string with an array of strings and printing the count