Redacted 4/6


#1

It says I'm not printing each word form the user's text console. Help?

puts "What would you like to tell me?: "
text = gets.chomp

puts "What would you like to redact?: "
redact = gets.chomp

words = text.split (" ")
words.each do |word|
if
word == redact
print "REDACTED"
else
print words + ""
end
end


#2

redact could well be a list of words, so should also be made into a list:

redacts = redact.split( " ")

Now we need to nest a loop to iterate over the redacts.

words.each do |word|
    redacts.each do |red|
        if word != red
            print word + " "
        else
            print "REDACTED"
        end
    end
end