5 Redacated! control flow know how


puts "please enter some personal text"
text = gets.chomp

puts "please enter info to redact"
redact = gets.chomp

words = text.split ("")
words.each do |word|
if word == redact
print "REDACT"
print word + ""
I am so confused why this isnt working


Should read letters = text.split(""), if, that is, we were splitting between letters, such as that line does. To split between words, we use " " owing that the space character is a typical word separator.

words = text.split(" ")