Redacted!


#1

puts "agent zero"
text = gets.chomp
puts "the cafe"
redact = gets.chomp

words = text.split(" ")

words.each do |word|

if word == redact
print "REDACTED"
else
print word + " "
end
end

Can someone explain what I am doing wrong here? I keep getting the problem incorrect!


#2

You need a space after REDACTED, otherwise if your redacted word is not in the last position it will merge with the next word.