The first prompt would be for a phrase:
puts "Enter some text: " text = gets.chomp
The second prompt would be for the word to redact
puts "Enter a word to redact from text: " redact = gets.chomp
Don't define the text in your code. Enter it at the prompt.
words = text.split(' ')
Keep your print statements plain (do not use string interpolation).
if x != redact print word + " " else print "REDACTED " end
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.