Microsoft Interview Question

Replace substrings of a string with a given string.