new code for reverse string in place