6/6 Redacted! Bonus task!

Hey fellows! I’ve just finished improving my program to take multiple, separate words to REDACT
I’m so happy I finally made it working :blush: What do you guys think?

puts "Add a text"
text = gets.chomp

puts "Word to redact (separated with one cursor space)"
redact = gets.chomp

words = text.split(" ")
redacts = redact.split(" ")

words.each do |x|
    if redacts.include? x
    print "REDACTED "
else
    print x + " "
end
end
1 Like