Redacted, Lesson Summary, Advanced Exercise: trying to create an input that allows user to redact multiple words using spaces between the words
My code below however simply prints out all the words. It doesn't redact ANY of them.
puts "Please enter some text, separated by spaces: " text = gets.chomp.upcase puts "What words above do you wish to redact, separated by spaces? " redact = gets.chomp.upcase words = text.split(" ") redacted_words = text.split(" ") words.each do |placeholder| if placeholder != redacted_words.each do |x| end print placeholder + " " else print "REDACTED " end end