Given a string s, a target substring, and a replacement string, replace all occurrences of target in s with replacement.
Do not use any built-in replace or replaceAll methods. Implement the replacement logic manually.
Return the resulting string after all replacements are made.
s = "hello world hello", target = "hello", replacement = "hi""hi world hi"s = "aaa", target = "a", replacement = "bb""bbbbbb"s = "abc", target = "d", replacement = "e""abc"0 <= s.length <= 10^41 <= target.length <= 1000 <= replacement.length <= 100s, target, and replacement consist of printable ASCII charactersRun your code to see results
Use Cmd+Enter to run