Code accepted but wrong output (5/6)


Hi fellow coders,

The exercise accepted my code as correct yet it did not substitute any words with REDACT.

Could you please help me find the error?

text= gets.chomp
puts text 
redact= gets.chomp
puts redact
words= text.split(" ")

words.each do |words| 
    print words
    if words == redact
        print "REDACTED "
        print words + " "

Thank you very much in advance!


See this:

When this is fulfilled,

it will do as you have told it to...

Else, it will only leave a space as you've indicated here.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.