X1662: allUnderscore

Given a string, compute recursively a new string where all the adjacent chars are now separated by an underscore ("_"). So given "hello", return "h_e_l_l_o".

Examples:

allUnderscore("abc") -> "a_b_c"
allUnderscore("a") -> "a"

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.