@codekiddy Thanks, that worked. But what is the difference between using 'string &' rather than 'string' as the function's argument? Both seem to work fine.
when argument is string& then you are manipulating with original objet pased to the function.
This approach is called pass by reference.
When argument is string you are passing a copy of the parameter not the real object, thus if you change it inside the function your original copy outside the function will left untouched!
another reason is performance,
passing by reference is faster,
Why?
simply because you avoid copying the object.
I you look at this problem a little bit harder you may come to an interesting conclusion!
Your funciton does't have to return anything, instead it manipulates with original string!