Added part2 (replace) and its test cases.