X1661: Add Underscore

Given a string, compute recursively a new string where all spaces in the original one are replaced by an underscore (_).

So given "hello world", return "hello_world".

Examples:

addUnderscore("hello world") -> "hello_world"
addUnderscore("buenos dias") -> "buenos_dias"

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.