← all problems

insertAfter 🌶️🌶️

Write a method that takes three String parameters, text, target and addition, and returns text with addition inserted immediately after the first occurrence of target. For example, insertAfter("hello world", "hello", ",") should return "hello, world", and insertAfter("abc", "c", "!") should return "abc!". You may assume target appears in text at least once.