4/6 I need some help here


I’m having some trouble with this step.

My code so far is:

puts “Any type of text just give me some words please”
text = gets.chomp

words = text.split (" ")

puts “Words to redact”
redact = gets.chomp

words.each do |words|
print words+""

What is not working here?

Could anyone explain the steps to me? Thanks!


puts "Text to search through: "
#text = gets.chomp
text=“This is not a long text this is”
puts "Word to redact: "
#redact = gets.chomp
redact = “is”
#you will want to split the text

using a =space= char as separator

words = text.split (" ")

why redfine ??? words = [‘a’, ‘b’, ‘c’, ‘d’]

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



The problem is with the words in between the || and after print. Try replacing them by word


unfortunately this still doesn’t work :cry:


Got it!

text = gets.chomp
puts “text”

text = “Just a few words to finish this assignment”

redact = gets.chomp
puts “redact”

redact = “and some more to redact”

words = text.split(" ")

words.each do |words|
print words+""

Thanks for the help guys!