Redacted 4/6


I am doing exercise 4 in “Redacted” section,
and I think my code seems right, but the error message keeps popping up:

puts "Write something: "
text = gets.chomp
puts "Write something you want to be detected: "
redact = gets.chomp

words = text.split(" ")

words.each do |word|
  print words + " "

Can anybody tell me what I am doing wrong here?
Thank you.



print words + " "

you print words (which is an array) and try to concat it with a string.


So do you mean I can’t concat array with a string?
So I need to delete the last part which is

  • " " ?


yep, but this indicate you focus on the wrong thing

what is the purpose of the loop? To get the elements (strings) from array, but then inside the loop, use the strings, not the array.


I got it now,
Thank you!!