FAQ: Thith Meanth War! - Returning the Final String—Er, "Thtring"


This community-built FAQ covers the “Returning the Final String—Er, “Thtring”” exercise from the lesson “Thith Meanth War!”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Ruby

FAQs on the exercise Returning the Final String—Er, “Thtring”

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!


how to preserve the original user input and return the original and modified version with print command because after the gsub method the user_input always changes


You can create a copy of the original string to preserve its initial value, then manipulate the original, and print both in the final puts statement.

puts "#{original} => #{mutated}"
print "Please enter a string: " 
user_input = gets.chomp

if user_input.include? "s"
  puts "The 's' has been remplaced and now your string is equal to : #{user_input.gsub!(/s/, "th")}"
  puts "There are no 's's in your string."


hello !
this code above gave me the right output but the exercise kept on giving me a “wrong answer”, i don’t understand…


Is any of the verbosity expected by the lesson checker? When we embellish our responses the SCT can no longer recognize anything so will fail the submission. Remember it is a program that is checking our code, not a human reader.