I want my code to be able to redact words at the end of a sentence if there's a punctuation mark at the end so I added an OR condition.
But what ends up happening is it redacts the entire sentence with "REDACT REDACT REDACT" for every word in the sentence.
I don't get any error messages.
Can someone please help me figure out where I went wrong?
puts "Write something: " text = gets.chomp.downcase puts "This is what you want to redact: " redact = gets.chomp.downcase words = text.split(" ") words.each do |words| if words == (redact + ".") || redact print "REDACTED " else print words + " " end end