function solution(A, B) {
if (A === B) { return 0 }
let arr = [...A];
for(let i=0; i<arr.length; i++) {
arr.unshift(arr.pop())
if (arr.join('') === B) {
return i+1;
break;
}
}
return -1;
}
let solution=(a,b)=>(b+b).indexOf(a)
function solution(A, B) {
if (A===B) return 0;
for (let i = 0; i < A.length; i++) {
A = A.slice(-1) + A.slice(0,-1);
if (A === B) return i+1;
}
return -1;
}