swapping first and last characters