A simple C++ program for substituting parts of a string within strict memory constraints