What's wrong with my code?


#1

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"
        else
        print word + " " .
    end
end

Redacted 5/6
#2

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


#3

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


#4

Because that doesn't seem to do it.


#5

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!


#6