The code runs smoothly; however, I am trying to tackle the following challenges, and failing miserably:
- What could you do to make sure your redactor redacts a word regardless of whether it's upper case or lower case?
- How could you make your program take multiple, separate words to REDACT?
- How might you make a new redacted string and save it as a variable, rather than just printing it to the console?
I attempted to address #1 by adding .downcase! to the user's input, as well as a few other places, but it's not working for me... Help?
number 2 and number 3 are completely over my head... please help... thank you!
puts "Enter string of words:" text = gets.chomp.downcase! puts "Enter word you'd like redacted:" redact = gets.chomp.downcase! words = text.split(" ") words.each.downcase! do |word| if word != redact print word + " " else print "REDACTED " end end