Keeps saying undefined local variable or method


#1

so this is my code does anyone see whats wrong with it?

puts
text=gets.chomp
puts
redact=gets.chomp

words=text.split("")

words.each do |word|
if word == redacted
    print "REDACTED "
else
    print word + " "
end
end

#2

needs some text to output...

puts "Enter some text"
text = gets.chomp
puts "Enter a word to redact (no spaces)"
redact = gets.chomp

But the real error is,

The defined variable is, redact.

Also,

This will split between letters, not words. Change to .split(" ").