Insert a sub-string to a string

The C++ solution to http://dsalgo.openjudge.cn/dsmoochw2/2/