Need Help with my Code 5.6


#1

Not quite sure where I went wrong. It keeps telling me to print words from the user text to the console unless that word is the word to be redacted.

puts "Text to search through: "
text = gets.chomp
puts "Word to redact: "
redact = gets.chomp
words = text.split ("")
words = ['a', 'b', 'c', 'd']
words.each do |words|
print word
if word == redact
print = "REDACTED "
else
print word + " "
end
end


#2

@jj.epstein,

puts "Text to search through: "
#text = gets.chomp
text="This is not a long text this is"
puts "Word to redact: "
#redact = gets.chomp
redact = "is"
#you will want to split the text 
# using a =space= char as separator
words = text.split (" ")
# why redfine ??? words = ['a', 'b', 'c', 'd']
words.each do |word|
 #print word
 if word == redact
   print  "REDACTED "
 else 
   print word + " "
end
end