reverse the string without using temp variable