How to replace the charactors in the string?

Also, how did you get those timings? Make sure that you don’t benchmark in global scope.