Nested loop scenario app academy open

can anyone help me write code with (.each) nested loop.
in app academy it has been done with while loop.
i have tried all way but noyt getting result with .each method.

question:Write a method array_translate that takes in an array whose elements alternate between words and numbers. The method should return a string where each word is repeated the number of times that immediately follows in the array.

here is my code, please correct me.
def array_translate(array)
str=""

i = 0
array.each do |ele,num|
ele = array[i]
num = array[i + 1]
num.times {str+=ele}
i += 2
end
return str

end

print array_translate([“Cat”, 2, “Dog”, 3, “Mouse”, 1]); # => “CatCatDogDogDogMouse”
puts

print array_translate([“red”, 3, “blue”, 1]); # => “redredredblue”
puts

array. each only iterates thru each |element| of array
arra.each_with_index goes thru each |element, index|

and you are passing hash, so its ele is key and num is value
array.each do |ele, num|
num.times { str += ele}
end

should work, no need of i there