cpp implementation of Scramble String