String Rotation Of Each Other Leetcode Javascript