10 XP challenge

Replace Every Matching Character

easy
Build it yourself · 6 min
1 Learn2 Predict3 Solve

Task
Your mission

Return message with every target character replaced by replacement. Matching is case-sensitive. target and replacement are each exactly one ASCII character; message has 0 to 40 ASCII characters.

Examples

InputReturn
message = "banana", target = "a", replacement = "o"

answer: "" → "b" → "bo" → "bon" → "bono" → "bonon" → "bonono". The result is "bonono".

"bonono"
message = "", target = "a", replacement = "x"""

Your code

Write your answer inside Solution, then use return to send it back.

Try examples runs the public examples. Check my code checks your full answer and saves your completion.