What's wrong with my code?


Anyone out there who could tell me what's wrong with my code? I can't seem to figure it out. Cheers!

puts "Type your text here!"
text = gets.chomp

puts "What would you like redacted?"
redact = gets.chomp

words = text.split(" ")

words.each do |word|

    if word == redact
         print "REDACTED"
        print word + " " .

Redacted 5/6

"REDACTED " SPACE B/W D AND "" ,it will work


Do you mean "REDACTED" on the 8th line? As in a space between "REDACTED" and the quotation marks it's in? Like ' "REDACTED " '?


Because that doesn't seem to do it.


Sorry about the string of messages. I did need that space as well as to delete my period after 'print word + " " .' Thank you for your help!