Skip to content

Instantly share code, notes, and snippets.

@hungneox
Created April 6, 2014 02:45
Show Gist options
  • Save hungneox/10000856 to your computer and use it in GitHub Desktop.
Save hungneox/10000856 to your computer and use it in GitHub Desktop.
Ruby simple program, modify original text, replace selected word with REDACTED
puts "Please input original text:"
text = gets.chomp
puts "Please input redact:"
redact = gets.chomp
words = text.split(" ")
words.each do |word|
if word == redact
print "REDACTED "
else
print word + " "
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment