Redacted Greatwork! 6/6 help


#1



Trying to solve this --> How could you make your program take multiple, separate words to REDACT?


How can i improve this code? It will only work if i have one redacted word.

Thanks in advance!


puts "Text to search through: "
text = gets.chomp.downcase


puts "Text to redact: "
redact = gets.chomp.downcase

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

words.each do |word|
words2.each do |word2|
    if word.include? word2
        print "REDACTED "
    else
        print word + " "
    end
end
end


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.