reverse word using in place algorithm and ranges