#sample solution
text = gets.chomp
puts "Enter the word to redact / censor in your text: "
redact = gets.chomp
words = text.split(" ")
words.each {|word|
if word != redact
print "#{word}"+" "
else
print "REDACTED "
end
}
text = gets.chomp
puts "Enter the word to redact / censor in your text: "
redact = gets.chomp
words = text.split(" ")
words.each {|word|
if word != redact
print "#{word}"+" "
else
print "REDACTED "
end
}
No comments:
Post a Comment