Code works, but am told it is incorrect. 5/6 Redacted!


#1



Hello all,

I have completed the exercise and as far as I am concerned it is working correctly - as in it is correctly censoring the words to be hidden. However, I am told it is incorrect, and am not allowed to continue. Please see my code below.


Error message:
Oops, try again. Make sure to print each word from the user's text to the console unless that word is the word to be redacted; if it is, print REDACTED (all caps!).


puts "Tell me your secret"
text = gets.chomp
puts "now tell me which part of that we should hide"
secret = gets.chomp
words = text.split(" ")
words.each do |word|
    if word == secret
        print "REDACTED "
    else
        print word + " "
    end
end


#2

@afrover Maybe replace the variable secret with redacted like it says here https://www.codecademy.com/en/courses/ruby-beginner-en-mzrZ6/0/2?curriculum_id=5059f8619189a5000201fbcb