Re-write rotate without converting strings to arrays.
Re-write to avoid converting strings to arrays and arrays to strings.