solution to rotateRight